/* Holiday-style PDF Modal */
.worksheets-popup__modal-content {
    background: #f8f9fa;
    border: none;
    border-radius: 16px;
    font-family: 'Poppins', sans-serif;
}

.worksheets-popup__modal-dialog {
    max-width: 85vw;
}

.worksheets-popup__modal-header {
    background: linear-gradient(135deg, #FF6F3C 0%, #FF8F5C 100%);
    padding: 1.5rem;
    color: white;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: start;
    border-radius: 16px 16px 0 0;
}

.worksheets-popup__modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.worksheets-popup__modal-body {
    padding: 0;
    overflow-y: auto;
    position: relative;
    min-height: 400px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: start;
}

/* PDF List Container */
.worksheets-popup__list-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Toggle Section - Fixed at top */
.worksheets-popup__toggle-section {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    padding: 1rem 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 111, 60, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.worksheets-popup__toggle-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.worksheets-popup__toggle-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    padding: 1rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 2px solid rgba(255, 111, 60, 0.1);
    flex: 1;
    transition: all 0.3s ease;
    position: relative;
}

.worksheets-popup__toggle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.worksheets-popup__toggle-help-icon {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    cursor: help;
    transition: all 0.2s ease;
    z-index: 10;
}

.worksheets-popup__toggle-help-icon:hover {
    color: #51a010;
    transform: scale(1.1);
}

.worksheets-popup__toggle-help-icon i {
    font-size: 0.9rem;
}

.worksheets-popup__toggle-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF6F3C 0%, #FF8F5C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 111, 60, 0.3);
}

/* Word Bank Toggle Icon - Orange Color */
.worksheets-popup__toggle-card:nth-child(2) .worksheets-popup__toggle-icon {
    background: linear-gradient(135deg, #FF6F3C 0%, #FF8F5C 100%);
    box-shadow: 0 4px 12px rgba(255, 111, 60, 0.3);
}

/* Shareable Links Toggle Icon - Orange Color */
.worksheets-popup__toggle-card:nth-child(3) .worksheets-popup__toggle-icon {
    background: linear-gradient(135deg, #FF6F3C 0%, #FF8F5C 100%);
    box-shadow: 0 4px 12px rgba(255, 111, 60, 0.3);
}

.worksheets-popup__toggle-icon i {
    font-size: 1.5rem;
    color: white;
}

.worksheets-popup__toggle-content {
    flex-grow: 1;
    min-width: 0;
}

.worksheets-popup__toggle-content h6 {
    font-weight: 600;
    color: #1E262F;
    margin-bottom: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.worksheets-popup__toggle-content p {
    color: #6A7A8C;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
}

.worksheets-popup__toggle-switch {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.worksheets-popup__toggle-switch .form-check {
    display: flex;
    align-items: center;
    margin: 0;
}

.worksheets-popup__toggle-switch .form-check-label {
    font-size: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    position: absolute;
}

/* Bootstrap Form Switch Styling - Larger and more prominent */
.worksheets-popup__toggle-switch .form-check-input {
    width: 3.5rem;
    height: 1.75rem;
    margin-top: 0;
    background-color: #cbd5e0;
    border: 2px solid #a0aec0;
    border-radius: 2rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: left center;
    background-repeat: no-repeat;
    background-size: contain;
    transition: all 0.25s ease-in-out;
    cursor: pointer;
}

.worksheets-popup__toggle-switch .form-check-input:hover {
    background-color: #b8c5d1;
    border-color: #8e9fb1;
}

.worksheets-popup__toggle-switch .form-check-input:checked {
    background-color: #51a010;
    border-color: #438a0d;
    background-position: right center;
}

.worksheets-popup__toggle-switch .form-check-input:checked:hover {
    background-color: #5cb412;
    border-color: #4a9b10;
}

.worksheets-popup__toggle-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.3rem rgba(81, 160, 16, 0.25);
    border-color: #51a010;
    outline: none;
}

/* Toggle Select */
.worksheets-popup__toggle-select {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-width: 120px;
}

.worksheets-popup__toggle-select .form-select {
    width: 100%;
    min-width: 120px;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1E262F;
    background-color: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.worksheets-popup__toggle-select .form-select:hover {
    border-color: #51a010;
    background-color: #f8f9fa;
}

.worksheets-popup__toggle-select .form-select:focus {
    border-color: #51a010;
    box-shadow: 0 0 0 0.2rem rgba(81, 160, 16, 0.25);
    outline: none;
}

/* PDF Grid Layout */
.worksheets-popup__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
}

.worksheets-popup__grid-item {
    transition: transform 0.3s ease;
}

.worksheets-popup__grid-item:hover {
    transform: translateY(-2px);
}

.worksheets-popup__download-btn {
    display: block;
    background: white;
    border: 2px solid #51a010;
    border-radius: 12px;
    padding: 1rem;
    text-decoration: none;
    color: #5A9A2E;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.worksheets-popup__download-btn:hover {
    background: #51a010;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 193, 66, 0.3);
}

.worksheets-popup__download-btn:hover .worksheets-popup__btn-icon {
    transform: scale(1.1);
}

.worksheets-popup__btn-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    height: 100%;
    justify-content: space-between;
}

.worksheets-popup__btn-number {
    background: rgba(123, 193, 66, 0.1);
    color: #51a010;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid #51a010;
    transition: all 0.3s ease;
}

.worksheets-popup__download-btn:hover .worksheets-popup__btn-number {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: white;
}

.worksheets-popup__btn-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.worksheets-popup__btn-icon {
    color: #51a010;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.worksheets-popup__download-btn:hover .worksheets-popup__btn-icon {
    color: white;
}

.worksheets-popup__modal-footer {
    background-color: #FF6F3C;
    padding: 1rem 1.5rem;
    border-radius: 0 0 16px 16px;
    width: 100%;
}

.worksheets-popup__modal-footer-btns {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.worksheets-popup__scroll-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.worksheets-popup__scroll-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.worksheets-popup__footer-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.worksheets-popup__count-badge {
    background: #51a010;
    color: #fff;
    border: 1px solid #51a010;
    padding: 0.5rem 1rem;
    border-radius: 22px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
}

.worksheets-popup__manage-links-btn {
    background: white;
    color: #FF6F3C;
    border: 1px solid white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.worksheets-popup__manage-links-btn:hover {
    background: #f8f9fa;
    color: #E55A2B;
    text-decoration: none;
    border-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.worksheets-popup__manage-links-btn i {
    font-size: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .worksheets-popup__modal-dialog {
        max-width: 95%;
    }
    
    .worksheets-popup__modal-body {
        padding: 0;
    }
    
    .worksheets-popup__toggle-section {
        padding: 0.75rem 1rem;
    }
    
    .worksheets-popup__grid {
        padding: 1rem 1rem;
    }
    
    .worksheets-popup__modal-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }
    
    .worksheets-popup__modal-header .d-flex {
        width: 100%;
        justify-content: space-between;
    }
    
    .worksheets-popup__modal-title {
        font-size: 1.1rem;
    }
    
    .worksheets-popup__count-badge {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }
    
    .worksheets-popup__manage-links-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    .worksheets-popup__manage-links-btn i {
        font-size: 0.9rem;
    }
    
    .worksheets-popup__toggle-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .worksheets-popup__toggle-card {
        flex-direction: row;
        text-align: left;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .worksheets-popup__toggle-icon {
        width: 45px;
        height: 45px;
    }
    
    .worksheets-popup__toggle-icon i {
        font-size: 1.3rem;
    }
    
    .worksheets-popup__toggle-content h6 {
        font-size: 0.95rem;
    }
    
    .worksheets-popup__toggle-content p {
        font-size: 0.8rem;
    }
    
    .worksheets-popup__toggle-select .form-select {
        min-width: 100px;
        font-size: 0.85rem;
        padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    }
    
    .worksheets-popup__grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .worksheets-popup__download-btn {
        padding: 0.875rem;
    }
    
    .worksheets-popup__btn-title {
        font-size: 0.85rem;
    }
    
    .worksheets-popup__modal-footer-btns {
        flex-direction: column;
        gap: 10px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .worksheets-popup__manage-links-btn {
        font-size: 0.8rem;
        padding: 0.45rem 0.85rem;
    }
    
    .worksheets-popup__count-badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .worksheets-popup__toggle-row {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.25rem;
    }
    
    .worksheets-popup__toggle-card {
        padding: 1.25rem;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .worksheets-popup__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1201px) {
    .worksheets-popup__toggle-row {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .worksheets-popup__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Scrollbar styling */
.worksheets-popup__modal-body::-webkit-scrollbar {
    width: 8px;
}

.worksheets-popup__modal-body::-webkit-scrollbar-track {
    background: #f1faf7;
}

.worksheets-popup__modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FF6F3C 0%, #FF8F5C 100%);
    border-radius: 10px;
}

.worksheets-popup__modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #E55A2B 0%, #E67A4A 100%);
}

.worksheets-popup__container {
    scroll-behavior: smooth;
}

#modalPDF .form-check-input[type="checkbox"] {
    pointer-events: auto !important;
    z-index: 999 !important;
    position: relative !important;
}

/* Writing Prompt Selection Modal for Wordlist */
.writing-prompt-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 
                0 10px 30px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateZ(0);
    will-change: transform;
}

.writing-prompt-modal-header {
    background: linear-gradient(135deg, #7bc142 0%, #5a9c2f 100%);
    padding: 1.75rem 2rem;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
}

.writing-prompt-modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.writing-prompt-modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.writing-prompt-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: white;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.writing-prompt-modal-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.25rem 0 0 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.writing-prompt-modal-body {
    padding: 1.5rem 2rem 2rem 2rem;
    background: #f8f9fa;
    overflow-x: hidden;
}

.writing-prompt-selection .list-group {
    max-height: 450px;
    overflow-y: auto;
    border-radius: 8px;
}

.writing-prompt-selection .prompt-select-btn-wordlist,
.writing-prompt-selection .prompt-select-btn-pdf {
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #e2e8f0;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    background: white;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.writing-prompt-selection .prompt-select-btn-wordlist::before,
.writing-prompt-selection .prompt-select-btn-pdf::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(123, 193, 66, 0.1), transparent);
    transition: left 0.5s ease;
}

.writing-prompt-selection .prompt-select-btn-wordlist:hover,
.writing-prompt-selection .prompt-select-btn-pdf:hover {
    background-color: #f0f9eb;
    border-color: #7bc142;
    box-shadow: 0 4px 12px rgba(123, 193, 66, 0.2),
                0 2px 6px rgba(123, 193, 66, 0.15);
}

.writing-prompt-selection .prompt-select-btn-wordlist:hover::before,
.writing-prompt-selection .prompt-select-btn-pdf:hover::before {
    left: 100%;
}

.writing-prompt-selection .prompt-select-btn-wordlist:active,
.writing-prompt-selection .prompt-select-btn-pdf:active {
    background-color: #e5f5db;
    transform: translateY(0) translateX(0);
    box-shadow: 0 1px 3px rgba(123, 193, 66, 0.2);
    transition: all 0.1s ease;
}

.writing-prompt-selection h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

/* ============================================
   Sistema de Modals Empilhadas (Stacked Modals)
   ============================================ */

/* Overlay que aparece quando um modal secundário está aberto */
.wl-stack-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.65) 0%,
        rgba(17, 24, 39, 0.75) 50%,
        rgba(0, 0, 0, 0.65) 100%
    );
    backdrop-filter: blur(4px) saturate(0.8);
    -webkit-backdrop-filter: blur(4px) saturate(0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out, backdrop-filter 0.3s ease-in-out;
    animation: overlayPulse 3s ease-in-out infinite;
    display: none;
}

/* Quando o overlay está sendo exibido */
.wl-stack-overlay[style*="display: block"] {
    display: block !important;
}

/* Quando o overlay está sendo escondido */
.wl-stack-overlay[style*="display: none"] {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    animation: none !important;
}

/* Garantir que overlay sem classe active seja invisível */
.wl-stack-overlay:not(.active) {
    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes overlayPulse {
    0%, 100% {
        background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.65) 0%,
            rgba(17, 24, 39, 0.75) 50%,
            rgba(0, 0, 0, 0.65) 100%
        );
    }
    50% {
        background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.70) 0%,
            rgba(17, 24, 39, 0.80) 50%,
            rgba(0, 0, 0, 0.70) 100%
        );
    }
}

.wl-stack-overlay.active {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Congela a modal principal visualmente e desabilita clique */
#modalPDF.freeze {
    filter: blur(2px) saturate(0.9) brightness(0.95);
    pointer-events: none;
    transform: scale(0.98);
    transition: all 0.3s ease-in-out;
}

/* Enquanto empilhado, esconda o backdrop do Bootstrap e eleve o z-index do modal filho */
body.wl-stack-active .modal-backdrop {
    display: none !important;
}

body.wl-stack-active .modal.stacked-modal {
    z-index: 1065 !important;
    animation: modalStackFadeIn 0.3s ease-out;
}

@keyframes modalStackFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}