/* =====================================================
   ESFEM BIBLIOTECA DIGITAL - CSS GENERAL
===================================================== */

.esfem-reader{
    display:grid;
    grid-template-columns:320px minmax(0, 1fr);
    gap:46px;
    max-width:1500px;
    width:100%;
    margin:30px auto 80px auto;
    padding:0 32px;
    align-items:start;
}

.esfem-reader-sidebar{
    position:sticky;
    top:90px;
    align-self:start;
    width:320px;
    max-width:320px;
    height:calc(100vh - 110px);
    max-height:calc(100vh - 110px);
    overflow:hidden;
    display:flex;
    flex-direction:column;
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:18px;
    padding:18px;
    box-shadow:0 10px 28px rgba(15,23,42,0.06);
}

.esfem-reader-content{
    background:#fff;
    width:100%;
    max-width:100%;
    min-width:0;
}

.esfem-page-content,
.esfem-reader-content h1,
.esfem-nav-buttons,
.esfem-finish-reading,
.esfem-complete-box,
.esfem-notes-box{
    max-width:1050px;
    width:100%;
}

.esfem-cover img,
.esfem-library-cover img{
    width:100%;
    height:auto;
    border-radius:14px;
    margin-bottom:14px;
}

.esfem-cover img{
    max-height:130px;
    object-fit:cover;
}

.esfem-reader-sidebar h3{
    margin:0 0 18px 0;
    font-size:22px;
    line-height:1.25;
    color:#173f32;
}

.esfem-short-desc{
    font-size:14px;
    color:#4b5563;
    line-height:1.5;
    margin-bottom:22px;
}

/* Título página */
.esfem-reader-content h1{
    position:relative;
    padding:20px 24px 20px 30px;
    margin:0 0 28px 0 !important;
    background:#f0fdf4;
    border-left:7px solid #1f8a5b;
    border-radius:14px;
    color:#173f32 !important;
    font-size:32px !important;
    line-height:1.25;
    box-shadow:0 6px 18px rgba(0,0,0,0.04);
}

.esfem-reader-content h1::before{
    content:"📖";
    margin-right:10px;
}

.esfem-page-content{
    font-size:17px;
    line-height:1.8;
    color:#374151;
}

.esfem-page-content p{
    margin-bottom:18px;
}

/* =====================================================
   BOTONES
===================================================== */

.esfem-button{
    display:inline-block;
    padding:12px 24px;
    background:#22c55e;
    color:#fff !important;
    border-radius:10px;
    text-decoration:none;
    font-weight:700;
}

.esfem-button.secondary{
    background:#f3f4f6;
    color:#111827 !important;
}

.esfem-back-library{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:100% !important;
    padding:12px 14px !important;
    margin:14px 0 18px !important;
    background:#f0fdf4 !important;
    border:1px solid #bbf7d0 !important;
    border-radius:14px !important;
    color:#14532d !important;
    font-size:15px !important;
    font-weight:700 !important;
    text-decoration:none !important;
    box-shadow:0 4px 14px rgba(0,0,0,.04) !important;
}

.esfem-back-library:hover{
    background:#dcfce7 !important;
    border-color:#22c55e !important;
}

/* Favoritos */
.esfem-favorite-button{
    display:inline-block;
    margin:0 0 24px 0;
    padding:10px 16px;
    border:1px solid #fb7185;
    background:#ffffff;
    color:#e11d48;
    border-radius:999px;
    font-weight:700;
    cursor:pointer;
    transition:all .2s ease;
}

.esfem-favorite-button:hover{
    background:#fff1f2;
    transform:translateY(-1px);
}

.esfem-favorite-button.active{
    background:#e11d48;
    color:#ffffff;
    border-color:#e11d48;
}

/* Completar página */
.esfem-complete-box{
    margin-top:35px;
    padding:22px;
    background:#f0fdf4;
    border:1px solid #bbf7d0;
    border-radius:16px;
    text-align:center;
}

.esfem-complete-button{
    padding:12px 22px;
    border:none;
    border-radius:999px;
    background:#22c55e;
    color:#fff;
    font-weight:700;
    cursor:pointer;
}

.esfem-complete-button.completed{
    background:#166534;
}

#esfem-complete-status{
    display:block;
    margin-top:10px;
    color:#166534;
    font-size:14px;
}

/* Notas */
.esfem-notes-box{
    margin-top:45px;
    padding:24px;
    background:#f8fafc;
    border:1px solid #dbe3ea;
    border-radius:16px;
}

.esfem-notes-box h3{
    margin-top:0;
    margin-bottom:14px;
    color:#173f32;
}

#esfem-page-note{
    width:100%;
    min-height:140px;
    padding:14px;
    border:1px solid #cbd5e1;
    border-radius:10px;
    resize:vertical;
    font-size:15px;
    line-height:1.6;
    margin-bottom:14px;
}

#esfem-save-note{
    background:linear-gradient(135deg,#0f766e,#198754) !important;
    color:#ffffff !important;
    border:none !important;
    padding:12px 18px !important;
    border-radius:12px !important;
    font-weight:700 !important;
    box-shadow:0 8px 20px rgba(15,118,110,.18) !important;
}

#esfem-note-status{
    margin-left:12px;
    font-size:14px;
    color:#166534;
}

/* Navegación */
.esfem-nav-buttons{
    display:flex;
    justify-content:space-between;
    gap:20px;
    margin-top:50px;
    padding-top:25px;
    border-top:1px solid #e5e7eb;
}

.esfem-finish-reading{
    margin-top:40px;
    text-align:center;
}

/* =====================================================
   PROGRESO
===================================================== */

.esfem-progress-box{
    margin:12px 0 18px 0;
}

.esfem-progress-label{
    font-size:14px;
    font-weight:700;
    color:#166534;
    margin-bottom:8px;
}

.esfem-progress-bar{
    width:100%;
    height:10px;
    background:#e5e7eb;
    border-radius:999px;
    overflow:hidden;
}

.esfem-progress-bar span{
    display:block;
    height:100%;
    background:linear-gradient(90deg,#22c55e,#15803d);
    border-radius:999px;
}

/* =====================================================
   ÍNDICE ACORDEÓN
===================================================== */

.esfem-index{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    padding-right:8px;
    margin-top:12px;
}

.esfem-index ul{
    list-style:none;
    margin:0 0 14px 0;
    padding:0;
}

.esfem-accordion-module{
    margin-bottom:12px;
    border:1px solid #e5e7eb;
    border-radius:16px;
    background:#ffffff;
    overflow:hidden;
    transition:all .22s ease;
}

.esfem-accordion-toggle{
    width:100%;
    padding:16px 18px !important;
    background:#ffffff !important;
    color:#173f32 !important;
    border:none !important;
    border-radius:16px !important;
    font-size:15px !important;
    font-weight:700 !important;
    line-height:1.35 !important;
    display:flex !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    gap:10px !important;
    cursor:pointer;
    text-align:left;
    box-shadow:none !important;
    outline:none !important;
}

.esfem-accordion-toggle span:first-child,
.esfem-module-title{
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:normal;
    line-height:1.35;
}

.esfem-accordion-icon{
    color:#16a34a !important;
    font-weight:900 !important;
    flex-shrink:0;
    margin-top:2px;
    transition:transform .2s ease;
}

.esfem-accordion-module.open{
    background:#f0fdf4 !important;
    border:2px solid #86efac !important;
    box-shadow:0 10px 28px rgba(22,163,74,.12) !important;
}

.esfem-accordion-module.open .esfem-accordion-toggle{
    background:#dcfce7 !important;
    color:#166534 !important;
}

.esfem-accordion-module.open .esfem-accordion-icon{
    transform:rotate(180deg);
}

.esfem-accordion-pages{
    display:none;
    list-style:none;
    margin:0;
    padding:10px 12px 14px 12px !important;
    background:#ffffff;
}

.esfem-accordion-module.open .esfem-accordion-pages{
    display:block;
    background:#f8fff9 !important;
}

.esfem-index li{
    margin:5px 0 !important;
    border-radius:10px !important;
}

.esfem-index li a{
    display:block;
    padding:9px 10px !important;
    border-radius:10px !important;
    color:#334155 !important;
    font-size:14px !important;
    line-height:1.35 !important;
    text-decoration:none;
    transition:all .22s ease;
}

.esfem-index li.active a,
.esfem-index li a:hover{
    background:#bbf7d0 !important;
    color:#166534 !important;
    font-weight:700 !important;
}

/* Scroll */
.esfem-reader-sidebar::-webkit-scrollbar,
.esfem-index::-webkit-scrollbar{
    width:6px !important;
}

.esfem-reader-sidebar::-webkit-scrollbar-track,
.esfem-index::-webkit-scrollbar-track{
    background:#f1f5f9 !important;
    border-radius:999px !important;
}

.esfem-reader-sidebar::-webkit-scrollbar-thumb,
.esfem-index::-webkit-scrollbar-thumb{
    background:#86efac !important;
    border-radius:999px !important;
}

.esfem-reader-sidebar::-webkit-scrollbar-thumb:hover,
.esfem-index::-webkit-scrollbar-thumb:hover{
    background:#22c55e !important;
}

/* =====================================================
   BIBLIOTECA
===================================================== */

.esfem-library,
.esfem-library-wide{
    max-width:1500px !important;
    width:calc(100% - 40px) !important;
    margin:40px auto !important;
}

.esfem-library-layout{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 380px !important;
    gap:32px !important;
    align-items:start !important;
}

.esfem-library-grid{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:26px !important;
}

.esfem-library-card{
    background:#ffffff !important;
    border:1px solid #dceee8 !important;
    border-radius:22px !important;
    overflow:hidden !important;
    box-shadow:0 10px 26px rgba(15,23,42,0.06) !important;
}

.esfem-library-cover{
    height:190px !important;
    overflow:hidden !important;
}

.esfem-library-cover img{
    width:100% !important;
    height:190px !important;
    object-fit:cover !important;
    display:block !important;
}

.esfem-library-card h3{
    font-size:20px !important;
    line-height:1.3 !important;
    margin:20px 20px 10px !important;
    color:#173f32 !important;
}

.esfem-library-card p{
    font-size:15px !important;
    line-height:1.55 !important;
    margin:0 20px 16px !important;
    color:#4b5563 !important;
}

.esfem-library-card .esfem-progress-box{
    margin:0 20px 18px !important;
}

.esfem-library-card .esfem-button{
    margin:0 20px 22px !important;
    width:calc(100% - 40px) !important;
}

.esfem-library-sidebar{
    width:380px !important;
}

.esfem-recommendation-card{
    max-width:380px !important;
}

@media(max-width:1100px){

    .esfem-library-layout{
        grid-template-columns:1fr !important;
    }

    .esfem-library-grid{
        grid-template-columns:1fr !important;
    }

    .esfem-library-sidebar{
        width:100% !important;
    }

    .esfem-recommendation-card{
        max-width:100% !important;
    }

}
/* =====================================================
   DASHBOARD ALUMNO
===================================================== */

.esfem-dashboard-hero{
    max-width:1500px;
    width:100%;
    margin:30px auto 40px auto;
    padding:0 32px;
}

.esfem-dashboard-top{
    background:#f7faf7;
    border:1px solid #dbe7db;
    border-radius:24px;
    padding:30px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:30px;
}

.esfem-dashboard-welcome h2{
    margin:0 0 10px 0;
    font-size:34px;
    color:#173b2b;
}

.esfem-dashboard-welcome p{
    margin:0;
    font-size:17px;
    color:#557065;
}

.esfem-dashboard-nav{
    display:flex;
    gap:14px;
    flex-wrap:wrap;
}

.esfem-dashboard-nav a{
    background:white;
    border:1px solid #dfe7df;
    padding:12px 18px;
    border-radius:14px;
    text-decoration:none !important;
    color:#1f3d30 !important;
    font-weight:600;
    transition:.2s;
}

.esfem-dashboard-nav a:hover{
    background:#eef7ee;
    transform:translateY(-1px);
}

.esfem-student-bar{
    max-width:1500px;
    margin:20px auto 30px auto;
    padding:12px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    background:linear-gradient(180deg,#d9ead3,#b7d7a8);
    border:1px solid #9fc5a4;
    border-radius:14px;
    box-shadow:0 2px 10px rgba(0,0,0,.05);
}

.esfem-student-left{
    font-weight:700;
    color:#1f4d2e;
    font-size:16px;
}

.esfem-student-nav{
    display:flex;
    gap:18px;
    flex-wrap:wrap;
    align-items:center;
}

.esfem-student-nav a{
    text-decoration:none !important;
    font-weight:600;
    color:#1f4d2e !important;
    font-size:14px;
    display:flex;
    align-items:center;
    gap:6px;
    transition:.2s;
}

.esfem-student-nav a:hover{
    opacity:.75;
}

/* En escritorio ocultamos barra compacta */
@media (min-width:769px){
    .esfem-student-bar{
        display:none !important;
    }
}

/* =====================================================
   OCULTAR ELEMENTOS EN LECTOR
===================================================== */

.single-esfem_manual header,
.single-esfem_manual .site-header,
.single-esfem_manual .main-header,
.single-esfem_manual .navbar,
.single-esfem_manual .main-navigation,
.single-esfem_manual .ast-header-break-point,
.single-esfem_manual .ast-primary-header-bar,
.single-esfem_manual .ast-below-header-wrap,
.single-esfem_manual .site-below-footer-wrap,
.single-esfem_manual footer,
.single-esfem_manual .site-footer,
.single-esfem_manual .entry-header,
.single-esfem_manual .entry-title,
.single-esfem_manual h1.entry-title,
.single-esfem_manual .page-title,
.single-esfem_manual #wa-open,
.single-esfem_manual #wa-float,
.single-esfem_manual #wa-box,
.single-esfem_manual .cmplz-manage-consent,
.single-esfem_manual #cmplz-manage-consent,
.single-esfem_manual .joinchat,
.single-esfem_manual .chaty-widget,
.single-esfem_manual .floating-chat,
.single-esfem_manual .chat-widget{
    display:none !important;
}

.single-esfem_manual .site-content,
.single-esfem_manual .content-area,
.single-esfem_manual #primary,
.single-esfem_manual .ast-container,
.single-esfem_manual .site-main,
.single-esfem_manual article,
.single-esfem_manual .entry-content{
    max-width:100% !important;
    width:100% !important;
    margin-top:0 !important;
    padding-top:0 !important;
    padding-left:0 !important;
    padding-right:0 !important;
}

/* =====================================================
   CERTIFICADO
===================================================== */

.esfem-certificado-pro{
    max-width:900px;
    margin:50px auto;
    padding:30px;
    background:#fff;
    border-radius:16px;
    box-shadow:0 10px 30px rgba(0,0,0,0.08);
}

.esfem-certificado-header{
    text-align:center;
    margin-bottom:30px;
}

.esfem-certificado-header h1{
    margin:0;
    color:#173f32;
}

.esfem-certifica{
    text-align:center;
    font-weight:bold;
    letter-spacing:2px;
    margin-bottom:15px;
}

.esfem-alumno{
    text-align:center;
    font-size:30px;
    color:#1f8a5b;
    margin-bottom:5px;
}

.esfem-dni,
.esfem-texto{
    text-align:center;
}

.esfem-manual{
    text-align:center;
    font-size:22px;
    color:#0f3d2e;
    margin-bottom:25px;
}

.esfem-certificado-table{
    width:100%;
    border-collapse:collapse;
    margin-bottom:30px;
}

.esfem-certificado-table td{
    border:1px solid #e5e7eb;
    padding:12px;
}

.esfem-firma{
    display:flex;
    justify-content:space-between;
    border:1px solid #e5e7eb;
    padding:20px;
    border-radius:10px;
    font-size:14px;
}

.esfem-certificado-actions{
    text-align:center;
    margin-top:25px;
}

/* =====================================================
   MÓVIL
===================================================== */

.esfem-mobile-reader-bar{
    display:none;
}

.esfem-mobile-index-toggle{
    display:none;
}

@media (max-width:768px){

    .single-esfem_manual .site-header,
    .single-esfem_manual .ast-mobile-header-wrap,
    .single-esfem_manual .esfem-stickybar{
        display:none !important;
    }

    .esfem-dashboard-hero{
        display:none !important;
    }

    .esfem-student-bar{
        display:flex !important;
        flex-direction:column !important;
        align-items:stretch !important;
        gap:10px !important;
        margin:14px 16px 22px !important;
        padding:14px !important;
    }

    .single-esfem_manual .esfem-student-bar{
        display:none !important;
    }

    .esfem-student-left{
        text-align:center !important;
        font-size:15px !important;
    }

    .esfem-student-nav{
        display:grid !important;
        grid-template-columns:repeat(2,1fr) !important;
        gap:8px !important;
    }

    .esfem-student-nav a{
        text-align:center !important;
        background:#f0fdf4 !important;
        border:1px solid #bbf7d0 !important;
        padding:10px 8px !important;
        border-radius:12px !important;
        font-size:13px !important;
        justify-content:center;
    }

    .esfem-mobile-reader-bar{
        position:sticky;
        top:0;
        z-index:9999;
        display:flex;
        align-items:center;
        justify-content:space-between;
        gap:12px;
        background:linear-gradient(135deg,#0f766e,#198754);
        color:#fff;
        padding:10px 14px;
        border-radius:0 0 16px 16px;
        box-shadow:0 10px 25px rgba(0,0,0,.12);
        margin-bottom:18px;
    }

    .esfem-mobile-back{
        color:#fff !important;
        text-decoration:none;
        font-size:22px;
        font-weight:700;
    }

    .esfem-mobile-title{
        flex:1;
        font-size:14px;
        font-weight:700;
        line-height:1.25;
        overflow:hidden;
        display:-webkit-box;
        -webkit-line-clamp:2;
        -webkit-box-orient:vertical;
    }

    .single-esfem_manual .esfem-mobile-reader-bar .esfem-mobile-index-toggle{
        position:static !important;
        display:flex !important;
        align-items:center !important;
        justify-content:center !important;
        width:40px !important;
        height:40px !important;
        max-width:40px !important;
        padding:0 !important;
        margin:0 !important;
        border:none !important;
        border-radius:12px !important;
        background:rgba(255,255,255,.16) !important;
        color:#ffffff !important;
        font-size:22px !important;
        box-shadow:none !important;
        transform:none !important;
    }

    .single-esfem_manual .esfem-reader{
        display:block !important;
        max-width:100% !important;
        width:100% !important;
        margin:18px auto 60px auto !important;
        padding:0 14px !important;
    }

    .single-esfem_manual .esfem-reader-content,
    .single-esfem_manual .esfem-page-content,
    .single-esfem_manual .esfem-reader-content h1,
    .single-esfem_manual .esfem-nav-buttons,
    .single-esfem_manual .esfem-finish-reading,
    .single-esfem_manual .esfem-complete-box,
    .single-esfem_manual .esfem-notes-box{
        max-width:100% !important;
        width:100% !important;
    }

    .single-esfem_manual .esfem-reader-content h1{
        font-size:24px !important;
        line-height:1.25 !important;
        padding:16px 18px;
    }

    .single-esfem_manual .esfem-reader-sidebar{
        position:fixed !important;
        top:0 !important;
        left:-92vw !important;
        width:88vw !important;
        max-width:390px !important;
        height:100vh !important;
        max-height:100vh !important;
        z-index:100000 !important;
        background:#ffffff !important;
        overflow-y:auto !important;
        padding:22px 18px 90px 18px !important;
        border-radius:0 22px 22px 0 !important;
        box-shadow:12px 0 40px rgba(15,23,42,.25) !important;
        transition:left .28s ease !important;
    }

    body.esfem-index-open .esfem-reader-sidebar{
        left:0 !important;
    }

    body.esfem-index-open::before{
        content:"";
        position:fixed;
        inset:0;
        background:rgba(15,23,42,.45);
        z-index:99999;
    }

    .single-esfem_manual .esfem-reader-sidebar .esfem-index{
        max-height:none !important;
        overflow:visible !important;
    }

    .esfem-mobile-index-close{
        position:sticky;
        top:0;
        margin-left:auto;
        margin-bottom:16px;
        display:flex;
        align-items:center;
        justify-content:center;
        width:42px;
        height:42px;
        border:none;
        border-radius:14px;
        background:linear-gradient(135deg,#dc2626,#ef4444);
        color:#ffffff !important;
        font-size:30px;
        line-height:1;
        font-weight:700;
        box-shadow:0 8px 20px rgba(220,38,38,.25);
        cursor:pointer;
        z-index:5;
    }

    .esfem-library{
        margin:30px auto !important;
        padding:0 18px !important;
    }

    .esfem-library-grid{
        grid-template-columns:1fr !important;
    }
}

@media (min-width:769px){
    .esfem-mobile-index-close{
        display:none !important;
    }
}

/* =====================================================
   IMPRESIÓN CERTIFICADO
===================================================== */

@media print{

    @page{
        size:A4 portrait;
        margin:10mm;
    }

    html,
    body{
        background:#ffffff !important;
        margin:0 !important;
        padding:0 !important;
        width:100% !important;
        height:auto !important;
        overflow:visible !important;
        -webkit-print-color-adjust:exact !important;
        print-color-adjust:exact !important;
    }

    header,
    footer,
    .site-header,
    .site-footer,
    .esfem-certificado-actions,
    .esfem-certificado-actions *{
        display:none !important;
    }

    body *{
        visibility:visible !important;
    }

    body > *:not(.esfem-certificado-pro){
        display:none !important;
    }

    .esfem-certificado-pro{
        display:block !important;
        visibility:visible !important;
        position:static !important;
        width:190mm !important;
        max-width:190mm !important;
        margin:0 auto !important;
        padding:10mm !important;
        background:#ffffff !important;
        box-shadow:none !important;
        border:none !important;
        border-radius:0 !important;
    }

    .esfem-certificado-pro *{
        visibility:visible !important;
    }

    .esfem-certificado-table{
        width:100% !important;
        border-collapse:collapse !important;
    }

    .esfem-certificado-table td{
        border:1px solid #d1d5db !important;
        padding:8px !important;
    }
}
.esfem-itinerary-title{
    display:flex;
    gap:14px;
    align-items:center;
}

.esfem-itinerary-title img{
    width:64px;
    height:64px;
    border-radius:18px;
    object-fit:cover;
    box-shadow:0 8px 20px rgba(15,107,79,.16);
}