:root{
    --cbc-dark:#07111f;
    --cbc-navy:#0d1b2f;
    --cbc-red:#d62828;
    --cbc-yellow:#f6c445;
    --cbc-light:#f4f6fb;
    --cbc-muted:#64748b;
}
body{
    min-height:100vh;
    background:var(--cbc-light);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    padding-top:76px;
    color:#172033;
}
.cbc-navbar{
    background:linear-gradient(90deg, #050b14, #0d1b2f 65%, #111827);
    box-shadow:0 8px 22px rgba(0,0,0,.25);
}
.cbc-logo{
    width:44px;height:44px;border-radius:12px;
    display:inline-flex;align-items:center;justify-content:center;
    background:linear-gradient(135deg,var(--cbc-red),var(--cbc-yellow));
    color:white;font-weight:900;letter-spacing:.5px;
}
.fw-black{font-weight:900;}
.btn-cbc{
    background:var(--cbc-red);
    border:none;
    color:white!important;
    font-weight:700;
    border-radius:999px;
    padding:.55rem 1.2rem;
}
.btn-cbc:hover{background:#b91f1f;color:white!important;}
.btn-cbc-yellow{
    background:var(--cbc-yellow);
    color:#111!important;
    font-weight:800;
    border-radius:999px;
    padding:.7rem 1.4rem;
}
.cbc-hero{
    min-height:calc(100vh - 76px);
    display:flex;
    align-items:center;
    color:white;
    background:
        linear-gradient(110deg, rgba(3,8,18,.93), rgba(13,27,47,.82), rgba(0,0,0,.62)),
        var(--cbc-bg-image, url('../img/fondo-escolar.svg')) center/cover no-repeat;
}
.cbc-hero h1{font-size:clamp(2.4rem,5vw,5rem);font-weight:900;line-height:1;}
.cbc-hero p{font-size:1.15rem;max-width:720px;color:#e5e7eb;}
.cbc-card{
    border:0;border-radius:22px;
    box-shadow:0 14px 34px rgba(15,23,42,.12);
}
.cbc-stat{
    background:#fff;
    border-radius:20px;
    padding:1.4rem;
    border-left:6px solid var(--cbc-red);
    box-shadow:0 12px 26px rgba(15,23,42,.08);
    height:100%;
}
.cbc-stat .icon{
    width:44px;height:44px;border-radius:14px;
    display:inline-flex;align-items:center;justify-content:center;
    background:#fff5f5;font-size:1.35rem;
}
.cbc-panel{
    background:#fff;border-radius:24px;padding:1.5rem;
    box-shadow:0 12px 30px rgba(15,23,42,.10);
}
.cbc-footer{background:#050b14;color:#cbd5e1;}
.form-control,.form-select{border-radius:14px;padding:.75rem .95rem;}
.cbc-login-box{max-width:460px;margin:auto;}
.cbc-admin-menu{
    background:#fff;
    border-radius:22px;
    padding:.85rem;
    box-shadow:0 10px 24px rgba(15,23,42,.08);
}
.cbc-admin-link{
    display:inline-flex;
    align-items:center;
    gap:.35rem;
    padding:.65rem .9rem;
    border-radius:16px;
    color:#334155;
    text-decoration:none;
    font-weight:800;
    background:#f8fafc;
    border:1px solid #e5e7eb;
}
.cbc-admin-link:hover,
.cbc-admin-link.active{
    color:#fff;
    background:linear-gradient(135deg,var(--cbc-red),#8b1d1d);
    border-color:transparent;
}
.cbc-action-card{
    display:block;
    height:100%;
    text-decoration:none;
    color:#172033;
    background:#fff;
    border-radius:24px;
    padding:1.35rem;
    box-shadow:0 12px 30px rgba(15,23,42,.09);
    border:1px solid #eef2f7;
    transition:transform .15s ease, box-shadow .15s ease;
}
.cbc-action-card:hover{
    transform:translateY(-3px);
    color:#172033;
    box-shadow:0 18px 38px rgba(15,23,42,.14);
}
.cbc-action-icon{
    width:52px;height:52px;border-radius:18px;
    display:flex;align-items:center;justify-content:center;
    font-size:1.55rem;
    background:linear-gradient(135deg,#0d1b2f,#111827);
    color:#fff;
    margin-bottom:1rem;
}
.cbc-dark-panel{
    background:linear-gradient(135deg,#07111f,#0d1b2f);
    color:#fff;
    border-radius:26px;
    padding:1.5rem;
    box-shadow:0 16px 38px rgba(15,23,42,.20);
}
.cbc-dark-panel .text-muted{color:#cbd5e1!important;}
.table thead th{font-size:.78rem;text-transform:uppercase;color:#64748b;letter-spacing:.03em;}
.badge-soft{
    background:#f1f5f9;
    color:#334155;
    border:1px solid #e2e8f0;
}
@media (max-width: 575px){
    .cbc-admin-link{width:100%;justify-content:center;}
    .cbc-panel{padding:1rem;}
}
.cbc-cover-thumb{
    width:58px;
    height:78px;
    object-fit:cover;
    border-radius:12px;
    box-shadow:0 8px 18px rgba(15,23,42,.18);
    background:#e5e7eb;
}
.cbc-cover-empty{
    width:58px;
    height:78px;
    border-radius:12px;
    background:#f1f5f9;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.5rem;
    border:1px solid #e2e8f0;
}
.cbc-cover-preview{
    width:100%;
    max-height:360px;
    object-fit:cover;
    border-radius:22px;
    box-shadow:0 12px 30px rgba(0,0,0,.35);
    background:#111827;
}
.cbc-cover-placeholder{
    width:100%;
    min-height:260px;
    border-radius:22px;
    border:2px dashed rgba(255,255,255,.25);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:4rem;
    background:rgba(255,255,255,.06);
}
.cbc-book-card{
    background:#fff;
    border-radius:24px;
    overflow:hidden;
    border:1px solid #eef2f7;
    box-shadow:0 12px 28px rgba(15,23,42,.10);
    height:100%;
}
.cbc-book-card img{
    width:100%;
    height:230px;
    object-fit:cover;
    background:#e5e7eb;
}
.cbc-book-card .body{padding:1rem;}
.cbc-pdf-frame{
    width:100%;
    height:78vh;
    min-height:620px;
    border:1px solid #e2e8f0;
    border-radius:20px;
    background:#111827;
    box-shadow:0 12px 28px rgba(15,23,42,.12);
}
.cbc-reader-cover{
    width:100%;
    max-height:360px;
    object-fit:cover;
    border-radius:22px;
    box-shadow:0 12px 30px rgba(15,23,42,.18);
    background:#e5e7eb;
}
@media (max-width: 767px){
    .cbc-pdf-frame{height:70vh;min-height:480px;}
}
/* Fase 9 - lector por imágenes */
.cbc-cover-thumb-lg{
    width:110px;
    height:150px;
    object-fit:cover;
    border-radius:18px;
    box-shadow:0 12px 24px rgba(15,23,42,.18);
    background:#e5e7eb;
}
.cbc-page-thumb{
    width:64px;
    height:92px;
    object-fit:cover;
    border-radius:12px;
    border:1px solid #e2e8f0;
    box-shadow:0 8px 18px rgba(15,23,42,.14);
    background:#f1f5f9;
}
.cbc-image-reader{
    background:linear-gradient(135deg,#07111f,#111827);
    border-radius:24px;
    padding:1rem;
    min-height:520px;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.cbc-image-reader img{
    max-width:100%;
    max-height:82vh;
    object-fit:contain;
    border-radius:14px;
    background:#fff;
    box-shadow:0 16px 40px rgba(0,0,0,.35);
}
.cbc-page-strip{
    display:flex;
    flex-wrap:wrap;
    gap:.45rem;
}
.cbc-page-dot{
    min-width:38px;
    height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:#f1f5f9;
    border:1px solid #e2e8f0;
    color:#334155;
    text-decoration:none;
    font-weight:800;
    font-size:.85rem;
}
.cbc-page-dot:hover,
.cbc-page-dot.active{
    background:linear-gradient(135deg,var(--cbc-red),#8b1d1d);
    color:#fff;
    border-color:transparent;
}
@media (max-width: 767px){
    .cbc-image-reader{min-height:360px;padding:.6rem;border-radius:18px;}
    .cbc-cover-thumb-lg{width:82px;height:112px;}
}

/* Fase 11 - Catálogo lector mejorado */
.cbc-library-hero{
    color:#fff;
    border-radius:30px;
    padding:2rem;
    background:
        linear-gradient(120deg, rgba(3,8,18,.96), rgba(13,27,47,.88), rgba(139,29,29,.72)),
        var(--cbc-bg-image, url('../img/fondo-escolar.svg')) center/cover no-repeat;
    box-shadow:0 18px 44px rgba(15,23,42,.22);
    overflow:hidden;
}
.cbc-library-hero p{color:#e5e7eb;font-size:1.05rem;}
.cbc-hero-badge{
    width:220px;
    min-height:170px;
    border-radius:28px;
    padding:1.2rem;
    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.22);
    backdrop-filter:blur(8px);
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    text-align:center;
    color:#fff;
}
.cbc-hero-badge small{display:block;color:#e5e7eb;margin-top:.25rem;}
.cbc-quick-search{
    display:flex;
    gap:.7rem;
    max-width:720px;
    padding:.45rem;
    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.20);
    border-radius:999px;
}
.cbc-quick-search .form-control{
    border-radius:999px;
    border:0;
}
.cbc-mini-stat{
    background:#fff;
    border-radius:22px;
    padding:1.1rem;
    box-shadow:0 12px 28px rgba(15,23,42,.09);
    border:1px solid #eef2f7;
    display:flex;
    flex-direction:column;
    gap:.15rem;
    min-height:128px;
}
.cbc-mini-stat span{font-size:1.8rem;}
.cbc-mini-stat strong{font-size:1.8rem;font-weight:900;color:#0f172a;line-height:1;}
.cbc-mini-stat small{color:#64748b;font-weight:700;}
.cbc-category-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
    gap:1rem;
}
.cbc-category-card{
    background:#fff;
    border:1px solid #eef2f7;
    border-radius:22px;
    padding:1.1rem;
    box-shadow:0 10px 24px rgba(15,23,42,.08);
    text-decoration:none;
    color:#172033;
    display:flex;
    align-items:center;
    gap:.75rem;
    transition:transform .15s ease, box-shadow .15s ease;
}
.cbc-category-card:hover{
    color:#172033;
    transform:translateY(-2px);
    box-shadow:0 16px 34px rgba(15,23,42,.13);
}
.cbc-category-card span{font-size:1.8rem;}
.cbc-book-card-reader{
    transition:transform .15s ease, box-shadow .15s ease;
}
.cbc-book-card-reader:hover{
    transform:translateY(-3px);
    box-shadow:0 18px 38px rgba(15,23,42,.15);
}
.cbc-book-cover-link{display:block;text-decoration:none;color:inherit;}
.cbc-book-cover-empty{
    height:230px;
    background:linear-gradient(135deg,#e2e8f0,#f8fafc);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:4rem;
}
.cbc-resource-tags{
    display:flex;
    flex-wrap:wrap;
    gap:.35rem;
}
.cbc-resource-tags span{
    font-size:.72rem;
    font-weight:900;
    letter-spacing:.02em;
    color:#334155;
    background:#f1f5f9;
    border:1px solid #e2e8f0;
    padding:.25rem .5rem;
    border-radius:999px;
}
.cbc-line-1,.cbc-line-2{
    overflow:hidden;
    display:-webkit-box;
    -webkit-box-orient:vertical;
}
.cbc-line-1{-webkit-line-clamp:1;}
.cbc-line-2{-webkit-line-clamp:2;}
.cbc-category-scroller{
    display:flex;
    gap:.7rem;
    overflow-x:auto;
    padding:.15rem .1rem .65rem;
}
.cbc-category-pill{
    border:1px solid #e2e8f0;
    background:#fff;
    border-radius:999px;
    padding:.65rem 1rem;
    font-weight:900;
    color:#334155;
    white-space:nowrap;
    box-shadow:0 8px 18px rgba(15,23,42,.06);
}
.cbc-category-pill:hover,
.cbc-category-pill.active{
    border-color:transparent;
    background:linear-gradient(135deg,var(--cbc-red),#8b1d1d);
    color:#fff;
}
.cbc-loading-card{
    background:#f8fafc;
    border:1px dashed #cbd5e1;
    color:#475569;
    border-radius:20px;
    padding:2rem;
    text-align:center;
    font-weight:800;
}
@media (max-width: 767px){
    .cbc-library-hero{padding:1.25rem;border-radius:22px;}
    .cbc-quick-search{border-radius:24px;flex-direction:column;background:rgba(255,255,255,.08);}
    .cbc-hero-badge{width:100%;}
}


/* Fase 12 - buscador AJAX avanzado */
.cbc-library-hero{
    background:linear-gradient(135deg,#07111f,#0d1b2f 70%,#111827);
    color:#fff;
    border-radius:28px;
    padding:2rem;
    box-shadow:0 16px 38px rgba(15,23,42,.22);
    overflow:hidden;
    position:relative;
}
.cbc-library-hero:after{
    content:"";
    position:absolute;
    width:260px;
    height:260px;
    border-radius:999px;
    background:rgba(246,196,69,.14);
    right:-90px;
    top:-90px;
}
.cbc-hero-badge{
    display:inline-flex;
    flex-direction:column;
    gap:.15rem;
    background:rgba(255,255,255,.10);
    border:1px solid rgba(255,255,255,.18);
    border-radius:22px;
    padding:1.15rem 1.4rem;
    min-width:210px;
    backdrop-filter:blur(8px);
}
.cbc-hero-badge small{color:#cbd5e1;}
.cbc-category-scroller{
    display:flex;
    gap:.65rem;
    overflow-x:auto;
    padding:.15rem .15rem .7rem;
}
.cbc-category-pill{
    border:1px solid #e2e8f0;
    background:#fff;
    color:#334155;
    border-radius:999px;
    padding:.65rem 1rem;
    font-weight:800;
    white-space:nowrap;
    box-shadow:0 8px 18px rgba(15,23,42,.06);
}
.cbc-category-pill.active,
.cbc-category-pill:hover{
    background:linear-gradient(135deg,var(--cbc-red),#8b1d1d);
    color:#fff;
    border-color:transparent;
}
.cbc-book-card-reader .cbc-book-cover-link{
    display:block;
    min-height:230px;
    background:#e5e7eb;
}
.cbc-book-cover-empty{
    height:230px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:4rem;
    background:linear-gradient(135deg,#e2e8f0,#f8fafc);
}
.cbc-line-1,
.cbc-line-2{
    display:-webkit-box;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.cbc-line-1{-webkit-line-clamp:1;}
.cbc-line-2{-webkit-line-clamp:2;}
.cbc-resource-tags{
    display:flex;
    flex-wrap:wrap;
    gap:.35rem;
}
.cbc-resource-tags span{
    font-size:.72rem;
    font-weight:900;
    border-radius:999px;
    background:#f1f5f9;
    border:1px solid #e2e8f0;
    color:#334155;
    padding:.2rem .55rem;
}
.cbc-loading-card{
    border:1px dashed #cbd5e1;
    border-radius:18px;
    background:#f8fafc;
    padding:1.25rem;
    text-align:center;
    color:#64748b;
    font-weight:800;
}
.cbc-pagination .btn{min-width:42px;font-weight:800;}
.cbc-page-dots{padding:.25rem .35rem;color:#64748b;font-weight:900;}
@media (max-width: 575px){
    .cbc-library-hero{padding:1.25rem;border-radius:22px;}
    .cbc-hero-badge{width:100%;}
}

/* Fase 13 - Vista completa profesional del libro */
.cbc-book-hero{
    background:#fff;
    border-radius:30px;
    padding:1.6rem;
    box-shadow:0 16px 40px rgba(15,23,42,.12);
    border:1px solid #eef2f7;
}
.cbc-book-cover-box{
    background:linear-gradient(135deg,#07111f,#111827);
    border-radius:28px;
    padding:.75rem;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.cbc-book-meta-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
    gap:.75rem;
}
.cbc-book-meta-grid div{
    background:#f8fafc;
    border:1px solid #e2e8f0;
    border-radius:18px;
    padding:.8rem .95rem;
}
.cbc-book-meta-grid span{
    display:block;
    font-size:.72rem;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#64748b;
    font-weight:900;
    margin-bottom:.15rem;
}
.cbc-book-meta-grid strong{
    color:#0f172a;
    font-weight:900;
}
.cbc-book-description{
    background:#fff7ed;
    border:1px solid #fed7aa;
    border-radius:20px;
    padding:1rem;
}
.cbc-resource-card{
    background:#fff;
    border:1px solid #eef2f7;
    border-radius:24px;
    padding:1.25rem;
    box-shadow:0 12px 28px rgba(15,23,42,.09);
}
.cbc-resource-card .icon{
    width:52px;
    height:52px;
    border-radius:18px;
    background:linear-gradient(135deg,#0d1b2f,#111827);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.5rem;
    margin-bottom:.85rem;
}
.cbc-url-card{
    border:1px solid #e2e8f0;
    background:#f8fafc;
    border-radius:22px;
    padding:1rem;
}
.cbc-related-book{
    display:block;
    height:100%;
    text-decoration:none;
    color:#172033;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    border-radius:20px;
    padding:.75rem;
    transition:transform .15s ease, box-shadow .15s ease;
}
.cbc-related-book:hover{
    color:#172033;
    transform:translateY(-3px);
    box-shadow:0 16px 34px rgba(15,23,42,.13);
}
.cbc-related-book img,
.cbc-related-empty{
    width:100%;
    height:180px;
    object-fit:cover;
    border-radius:16px;
    background:#e5e7eb;
    margin-bottom:.75rem;
}
.cbc-related-empty{
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:3rem;
}
@media (max-width: 767px){
    .cbc-book-hero{padding:1rem;border-radius:22px;}
    .cbc-book-meta-grid{grid-template-columns:1fr;}
    .cbc-related-book img,.cbc-related-empty{height:150px;}
}

/* Fase 14 - Lector digital avanzado por imágenes */
.cbc-reader-shell{
    background:linear-gradient(135deg,#050b14,#0d1b2f 64%,#111827);
    border-radius:30px;
    padding:1.15rem;
    box-shadow:0 18px 44px rgba(15,23,42,.25);
    border:1px solid rgba(255,255,255,.08);
    overflow:hidden;
}
.cbc-reader-topbar{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:1rem;
    padding:.45rem .25rem 1rem;
}
.cbc-reader-actions,
.cbc-reader-toolbar{
    display:flex;
    flex-wrap:wrap;
    gap:.45rem;
    align-items:center;
}
.cbc-reader-toolbar{
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.10);
    border-radius:20px;
    padding:.65rem;
    margin-bottom:1rem;
}
.cbc-reader-toolbar .btn{
    border-radius:999px;
    font-weight:800;
}
.cbc-reader-help{
    color:#cbd5e1;
    font-size:.78rem;
    font-weight:700;
}
.cbc-reader-stage{
    position:relative;
    background:#0b1220;
    border-radius:24px;
    min-height:74vh;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:auto;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.cbc-reader-canvas{
    width:100%;
    min-height:74vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:1rem;
    transform-origin:center center;
}
.cbc-reader-canvas img{
    max-width:100%;
    max-height:72vh;
    object-fit:contain;
    border-radius:14px;
    background:#fff;
    box-shadow:0 18px 46px rgba(0,0,0,.45);
    transition:transform .18s ease;
    cursor:zoom-in;
}
.cbc-reader-side-nav{
    position:absolute;
    top:50%;
    transform:translateY(-50%);
    z-index:3;
    width:48px;
    height:72px;
    border:0;
    border-radius:999px;
    background:rgba(255,255,255,.88);
    color:#0f172a;
    font-size:2.25rem;
    line-height:1;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 12px 26px rgba(0,0,0,.25);
}
.cbc-reader-side-nav:hover{background:#fff;}
.cbc-reader-side-nav:disabled{opacity:.25;cursor:not-allowed;}
.cbc-reader-side-nav.left{left:.8rem;}
.cbc-reader-side-nav.right{right:.8rem;}
.cbc-reader-progress{
    height:10px;
    background:rgba(255,255,255,.12);
    border-radius:999px;
    overflow:hidden;
}
.cbc-reader-progress div{
    height:100%;
    background:linear-gradient(90deg,var(--cbc-red),var(--cbc-yellow));
    border-radius:999px;
}
.cbc-reader-thumbs{
    display:flex;
    gap:.7rem;
    overflow-x:auto;
    padding:.2rem .2rem .85rem;
}
.cbc-reader-thumb{
    position:relative;
    display:block;
    min-width:74px;
    text-decoration:none;
    color:#fff;
    border-radius:16px;
    border:2px solid transparent;
    opacity:.7;
    transition:opacity .15s ease, transform .15s ease, border-color .15s ease;
}
.cbc-reader-thumb:hover,
.cbc-reader-thumb.active{
    opacity:1;
    transform:translateY(-2px);
    border-color:var(--cbc-yellow);
}
.cbc-reader-thumb img{
    width:70px;
    height:98px;
    object-fit:cover;
    border-radius:13px;
    background:#fff;
    box-shadow:0 10px 22px rgba(0,0,0,.28);
}
.cbc-reader-thumb span{
    position:absolute;
    right:-.35rem;
    bottom:-.35rem;
    min-width:26px;
    height:26px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:var(--cbc-red);
    border:2px solid #0d1b2f;
    border-radius:999px;
    font-size:.72rem;
    font-weight:900;
}
.cbc-reader-stage:fullscreen{
    border-radius:0;
    background:#020617;
}
.cbc-reader-stage:fullscreen .cbc-reader-canvas,
.cbc-reader-stage:fullscreen .cbc-reader-canvas img{
    max-height:96vh;
}
@media (max-width: 767px){
    .cbc-reader-shell{border-radius:22px;padding:.8rem;}
    .cbc-reader-stage,.cbc-reader-canvas{min-height:58vh;}
    .cbc-reader-canvas{padding:.6rem;}
    .cbc-reader-canvas img{max-height:56vh;}
    .cbc-reader-side-nav{width:38px;height:58px;font-size:1.8rem;}
    .cbc-reader-side-nav.left{left:.35rem;}
    .cbc-reader-side-nav.right{right:.35rem;}
    .cbc-reader-help{display:none;}
}


/* Fase 17 - Pulido visual institucional CBC Biblioteca Virtual */
:root{
    --cbc-glass:rgba(255,255,255,.10);
    --cbc-border:rgba(255,255,255,.16);
}
body{
    background:
        radial-gradient(circle at top left, rgba(13,27,47,.08), transparent 34%),
        linear-gradient(180deg,#f8fafc,#eef2f7 52%,#f8fafc);
}
.cbc-navbar{
    backdrop-filter: blur(12px);
    border-bottom:1px solid rgba(255,255,255,.08);
}
.navbar-brand span:last-child{
    font-weight:900;
    letter-spacing:.01em;
}
.navbar .nav-link{
    font-weight:800;
    border-radius:999px;
    padding:.45rem .85rem!important;
}
.navbar .nav-link:hover{
    background:rgba(255,255,255,.08);
}
.cbc-hero{
    position:relative;
    overflow:hidden;
}
.cbc-hero:before{
    content:"";
    position:absolute;
    inset:0;
    background:
        radial-gradient(circle at 80% 20%, rgba(246,196,69,.22), transparent 24%),
        radial-gradient(circle at 20% 80%, rgba(214,40,40,.18), transparent 28%);
    pointer-events:none;
}
.cbc-hero .container{position:relative;z-index:1;}
.cbc-hero h1,
.cbc-library-hero h1{
    text-shadow:0 8px 24px rgba(0,0,0,.35);
}
.cbc-panel{
    border:1px solid rgba(255,255,255,.35);
}
.cbc-panel.text-dark{
    background:rgba(255,255,255,.94);
    backdrop-filter:blur(10px);
}
.cbc-card,
.cbc-book-card,
.cbc-action-card,
.cbc-resource-card,
.cbc-mini-stat,
.cbc-category-card,
.cbc-book-hero{
    border:1px solid rgba(226,232,240,.92);
    box-shadow:0 18px 40px rgba(15,23,42,.10);
}
.cbc-card:hover,
.cbc-book-card:hover,
.cbc-action-card:hover,
.cbc-category-card:hover,
.cbc-resource-card:hover{
    box-shadow:0 24px 50px rgba(15,23,42,.16);
}
.btn-cbc,
.btn-cbc-yellow,
.btn-danger,
.btn-warning{
    box-shadow:0 10px 22px rgba(15,23,42,.16);
}
.btn-cbc-yellow:hover{
    transform:translateY(-1px);
    filter:brightness(.98);
}
.cbc-page-title{
    background:#fff;
    border:1px solid #eef2f7;
    border-radius:26px;
    padding:1.2rem 1.35rem;
    box-shadow:0 12px 30px rgba(15,23,42,.08);
}
.cbc-admin-menu{
    position:sticky;
    top:88px;
    z-index:10;
    border:1px solid #eef2f7;
}
.table{
    vertical-align:middle;
}
.table tbody tr{
    transition:background .12s ease;
}
.table tbody tr:hover{
    background:#f8fafc;
}
.card{
    border-radius:22px;
    border-color:#eef2f7;
}
.card-header{
    border-top-left-radius:22px!important;
    border-top-right-radius:22px!important;
    font-weight:900;
}
.form-control:focus,
.form-select:focus{
    border-color:var(--cbc-yellow);
    box-shadow:0 0 0 .22rem rgba(246,196,69,.22);
}
.cbc-book-card img,
.cbc-cover-thumb,
.cbc-cover-thumb-lg,
.cbc-reader-cover,
.cbc-related-book img{
    border:1px solid rgba(15,23,42,.08);
}
.cbc-book-card-reader{
    position:relative;
}
.cbc-book-card-reader:after{
    content:"";
    position:absolute;
    inset:auto 1rem 0 1rem;
    height:3px;
    border-radius:999px;
    background:linear-gradient(90deg,var(--cbc-red),var(--cbc-yellow));
    opacity:.0;
    transition:opacity .15s ease;
}
.cbc-book-card-reader:hover:after{opacity:1;}
.cbc-library-hero{
    border:1px solid rgba(255,255,255,.14);
}
.cbc-resource-card .icon,
.cbc-action-icon{
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.08), 0 10px 22px rgba(15,23,42,.20);
}
.cbc-footer{
    border-top:1px solid rgba(255,255,255,.08);
}
@media (max-width: 1199.98px){
    .cbc-admin-menu{position:static;}
    .navbar-collapse{
        margin-top:.75rem;
        padding:1rem;
        background:rgba(3,8,18,.96);
        border-radius:18px;
        border:1px solid rgba(255,255,255,.08);
    }
}
@media print{
    .cbc-navbar,.cbc-footer,.cbc-admin-menu,.btn{display:none!important;}
    body{padding-top:0;background:#fff;}
    .cbc-page-title,.card,.cbc-panel{box-shadow:none!important;}
}

/* Navegación adaptable: evita que el menú se comprima o muestre barras de desplazamiento. */
.cbc-navbar .navbar-collapse{
    overflow:visible;
}
.cbc-navbar .navbar-nav{
    min-width:0;
}
.cbc-navbar .dropdown-menu{
    overflow:visible;
}
@media (min-width: 1200px){
    .cbc-navbar .navbar-collapse{
        display:flex!important;
        max-height:none!important;
        overflow:visible!important;
    }
    .cbc-navbar .navbar-nav{
        flex-wrap:nowrap;
        align-items:center;
    }
    .cbc-navbar .nav-item{
        flex:0 0 auto;
    }
}
@media (max-width: 1199.98px){
    .cbc-navbar .navbar-collapse{
        max-height:calc(100vh - 84px);
        overflow-y:auto;
        overflow-x:hidden;
    }
    .cbc-navbar .navbar-nav{
        width:100%;
        align-items:stretch!important;
    }
    .cbc-navbar .nav-item,
    .cbc-navbar .dropdown{
        width:100%;
    }
}

/* =========================================================
   Adaptación móvil global - CBC Biblioteca Virtual
   Mejora menús, tablas, tarjetas, formularios y lector en celular.
   ========================================================= */
html{scroll-padding-top:86px;}
img,video,iframe{max-width:100%;}
.navbar .container{gap:.5rem;}
.navbar-brand{min-width:0;max-width:calc(100% - 64px);}
.navbar-brand span:last-child{white-space:normal;line-height:1.05;}
.navbar-collapse{max-height:none;overflow:visible;}
.dropdown-menu{border-radius:18px;box-shadow:0 18px 38px rgba(15,23,42,.16);}
.cbc-admin-links{align-items:center;}
.cbc-admin-menu-toggle{border-radius:18px;}
.cbc-table-scroll,.table-responsive{border-radius:18px;}
.cbc-mobile-stack{gap:.75rem;}

@media (max-width: 1199.98px){
    body{padding-top:72px;}
    .cbc-navbar .navbar-collapse{
        margin-top:.85rem;
        background:rgba(7,17,31,.98);
        border:1px solid rgba(255,255,255,.10);
        border-radius:22px;
        padding:.75rem;
        box-shadow:0 18px 40px rgba(0,0,0,.28);
    }
    .navbar .nav-link,
    .navbar .dropdown-item,
    .navbar .btn-cbc{
        width:100%;
        display:flex;
        justify-content:flex-start;
        align-items:center;
        min-height:44px;
        margin:.15rem 0;
    }
    .navbar .btn-cbc{justify-content:center;margin-top:.5rem;}
    .dropdown-menu{
        position:static!important;
        transform:none!important;
        border:0;
        background:#fff;
        margin:.35rem 0 .5rem;
        width:100%;
    }
    .cbc-hero{min-height:auto;padding:3rem 0;}
    .cbc-hero h1{font-size:clamp(2rem,9vw,3rem);}
    .cbc-page-title{padding:1rem;border-radius:20px;}
    .cbc-page-title h1{font-size:1.55rem;}
    .cbc-library-hero{padding:1.2rem;border-radius:22px;}
    .cbc-library-hero h1{font-size:1.75rem;}
    .cbc-hero-badge{width:100%;min-width:0;}
    .cbc-pdf-frame{height:70vh;min-height:460px;border-radius:16px;}
}

@media (max-width: 767.98px){
    body{font-size:15px;}
    main.container,.container.py-5{padding-top:1.35rem!important;padding-bottom:1.35rem!important;}
    .cbc-logo{width:40px;height:40px;border-radius:12px;font-size:.92rem;}
    .navbar-brand{font-size:.95rem;}
    .cbc-panel,.cbc-card,.cbc-book-card,.cbc-action-card,.cbc-mini-stat,.cbc-dark-panel{
        border-radius:18px;
        padding:1rem;
    }
    .cbc-book-card{padding:0;}
    .cbc-book-card img,.cbc-book-cover-empty{height:190px;}
    .cbc-book-card .body{padding:.9rem;}
    .cbc-stat{padding:1rem;border-radius:18px;}
    .cbc-admin-menu{
        position:sticky;
        top:72px;
        z-index:20;
        border-radius:20px;
        padding:.65rem;
    }
    .cbc-admin-links{display:grid!important;grid-template-columns:1fr;gap:.45rem!important;}
    .cbc-admin-link{width:100%;justify-content:flex-start;min-height:46px;border-radius:14px;}
    .cbc-catalog-categories{
        background:#fff;
        border:1px solid #eef2f7;
        border-radius:20px;
        padding:1rem;
        box-shadow:0 10px 24px rgba(15,23,42,.08);
    }
    .cbc-category-scroller{
        display:grid!important;
        grid-template-columns:1fr 1fr;
        gap:.55rem!important;
        overflow:visible!important;
        padding:.25rem 0 0!important;
    }
    .cbc-category-pill{
        width:100%;
        min-height:44px;
        display:flex;
        justify-content:center;
        align-items:center;
        white-space:normal!important;
        text-align:center;
        padding:.6rem .75rem!important;
        font-size:.92rem;
        line-height:1.1;
    }
    #cbcCatalogSearch .btn,
    #cbcCatalogReload,
    .cbc-panel .btn,
    form .btn{
        width:100%;
        min-height:44px;
    }
    .form-control,.form-select{min-height:46px;font-size:1rem;}
    .table{min-width:760px;}
    .cbc-panel > .table,
    .cbc-panel table,
    .card-body > table{
        display:block;
        width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
        white-space:nowrap;
    }
    .cbc-cover-preview,.cbc-reader-cover{max-height:260px;border-radius:18px;}
    .cbc-cover-thumb-lg{width:76px;height:104px;}
    .cbc-image-reader{min-height:330px;border-radius:18px;padding:.55rem;}
    .cbc-image-reader img{max-height:68vh;border-radius:10px;}
    .cbc-page-strip{overflow-x:auto;flex-wrap:nowrap;padding-bottom:.45rem;}
    .cbc-page-dot{min-width:42px;height:42px;}
    .cbc-pagination .btn{width:auto;min-width:42px;}
    .cbc-footer{margin-top:2rem!important;}
}

@media (max-width: 420px){
    .cbc-category-scroller{grid-template-columns:1fr!important;}
    .cbc-library-hero h1,.cbc-page-title h1{font-size:1.45rem;}
    .cbc-book-card img,.cbc-book-cover-empty{height:170px;}
    .cbc-mini-stat strong{font-size:1.45rem;}
}

/* Fase 2 - Visor modal de recursos externos */
.cbc-resource-modal .modal-content{
    border:0;
    border-radius:24px;
    overflow:hidden;
    box-shadow:0 28px 80px rgba(15,23,42,.35);
}
.cbc-resource-modal .modal-header,
.cbc-resource-modal .modal-footer{
    background:#fff;
    border-color:#eef2f7;
}
.cbc-resource-modal .modal-body{
    position:relative;
    min-height:72vh;
    background:#0f172a;
}
.cbc-resource-frame{
    display:block;
    width:100%;
    height:72vh;
    min-height:520px;
    border:0;
    background:#fff;
}
.cbc-resource-frame-loading{
    position:absolute;
    inset:0;
    z-index:2;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:2rem;
    color:#fff;
    font-weight:800;
    text-align:center;
    background:linear-gradient(135deg,#07111f,#14233a);
    transition:opacity .2s ease,visibility .2s ease;
}
.cbc-resource-frame-loading.is-hidden{
    opacity:0;
    visibility:hidden;
    pointer-events:none;
}
@media (max-width: 767.98px){
    .cbc-resource-modal .modal-dialog{
        margin:.5rem;
        max-width:calc(100% - 1rem);
    }
    .cbc-resource-modal .modal-content{border-radius:18px;}
    .cbc-resource-modal .modal-header{align-items:flex-start;padding:1rem;}
    .cbc-resource-modal .modal-footer{padding:.85rem;}
    .cbc-resource-modal .modal-footer > *{width:100%;}
    .cbc-resource-modal .modal-footer .d-flex{display:grid!important;grid-template-columns:1fr;}
    .cbc-resource-frame,
    .cbc-resource-modal .modal-body{
        height:74vh;
        min-height:420px;
    }
}
