:root {
    --navy: #0a2540;
    --navy-dark: #061a30;
    --navy-light: #14365c;
    --gold: #c9a227;
    --gold-light: #e0bd4a;
    --gold-dark: #a8861a;
    --cream: #f8f6f1;
    --cream-dark: #efe9dc;
    --burgundy: #5c0a0a;
    --text-dark: #1c2b3a;
    --text-muted: #6b7785;
    --border: #e3ddd0;
    --shadow-sm: 0 2px 8px rgba(10, 37, 64, .08);
    --shadow-md: 0 8px 24px rgba(10, 37, 64, .12);
    --shadow-lg: 0 16px 48px rgba(10, 37, 64, .18);
    --radius: 14px;
}

* { box-sizing: border-box; }

html { font-size: 16px; position: relative; min-height: 100%; }

body {
    margin: 0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.ltr { font-family: 'Playfair Display', 'Cairo', Georgia, serif; }
body.ltr h1, body.ltr h2, body.ltr h3, body.ltr h4 { font-family: 'Playfair Display', Georgia, serif; }

a { color: var(--navy); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold-dark); }

h1, h2, h3, h4, h5 { font-weight: 700; color: var(--navy); }

/* ============ HEADER ============ */
.site-header {
    background: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar {
    background: var(--navy);
    color: rgba(255,255,255,.85);
    font-size: .82rem;
    padding: 6px 0;
}
.topbar-contact { display: flex; gap: 22px; flex-wrap: wrap; }
.topbar-item { display: inline-flex; align-items: center; gap: 6px; }
.topbar-item svg { color: var(--gold-light); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.lang-toggle {
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(201, 162, 39, .15);
    border: 1px solid rgba(201, 162, 39, .4);
    padding: 4px 12px;
    border-radius: 30px;
    font-weight: 600;
    font-size: .82rem;
    transition: all .2s;
}
.lang-toggle:hover { background: var(--gold); color: var(--navy) !important; }
.lang-toggle svg { color: var(--gold-light); }

/* ============ NAV ============ */
.main-nav { background: #fff; padding: 12px 0; }
.navbar-brand { display: flex; align-items: center; gap: 12px; padding: 0; }
.brand-logo { width: 84px; height: 84px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; }
.brand-name { font-weight: 800; color: var(--navy); font-size: 1rem; }
.brand-sub { font-size: 1rem; color: #000; font-weight: 700; letter-spacing: .3px; margin-top: 4px; }

.navbar-nav { gap: 4px; }
.nav-item .nav-link {
    color: var(--navy) !important;
    font-weight: 600;
    padding: 10px 16px !important;
    border-radius: 8px;
    position: relative;
    transition: all .2s;
}
.nav-item .nav-link:hover { color: var(--gold-dark) !important; background: var(--cream); }
.nav-item .nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    inset-inline-start: 50%;
    transform: translateX(50%);
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width .25s;
}
[dir=rtl] .nav-item .nav-link::after { transform: translateX(-50%); }
.nav-item .nav-link:hover::after,
.nav-item.active .nav-link::after { width: 22px; }

.dropdown-toggle::after { font-size: .7rem; }
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    min-width: 240px;
}
.dropdown-item {
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--navy);
}
.dropdown-item:hover { background: var(--cream); color: var(--gold-dark); }
.dropdown-item .menu-icon { width: 32px; height: 32px; flex-shrink: 0; }

.nav-cta {
    background: var(--gold) !important;
    color: var(--navy) !important;
    font-weight: 700 !important;
    margin-inline-start: 8px;
}
.nav-cta:hover { background: var(--gold-light) !important; }
.nav-cta::after { display: none !important; }

/* ============ MAIN ============ */
.site-main { flex: 1 0 auto; }

/* ============ HERO (HOME) ============ */
.hero {
    position: relative;
    background:
        linear-gradient(135deg, rgba(10,37,64,.92), rgba(10,37,64,.78)),
        radial-gradient(circle at 20% 20%, rgba(201,162,39,.18), transparent 60%);
    color: #fff;
    padding: 80px 0 60px;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset-inline-start: -10%;
    top: -50%;
    width: 50%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(201,162,39,.08), transparent 70%);
    pointer-events: none;
}
.hero-content { max-width: 720px; position: relative; z-index: 2; }
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(201,162,39,.15);
    border: 1px solid rgba(201,162,39,.4);
    color: var(--gold-light);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.hero h1 {
    color: #fff;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 18px;
}
.hero .lead { font-size: 1.15rem; color: rgba(255,255,255,.88); margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn-gold {
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    padding: 12px 28px;
    border-radius: 30px;
    border: none;
    transition: all .2s;
}
.btn-gold:hover { background: var(--gold-light); color: var(--navy); transform: translateY(-2px); }
.btn-outline-light-2 {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,.5);
    padding: 10px 26px;
    border-radius: 30px;
    font-weight: 600;
    transition: all .2s;
}
.btn-outline-light-2:hover { background: #fff; color: var(--navy); }

/* ============ VIDEO SECTION ============ */
.video-section { padding: 70px 0; }
.section-title {
    text-align: center;
    margin-bottom: 12px;
    font-size: 2rem;
    font-weight: 800;
}
.section-title::after {
    content: '';
    display: block;
    width: 70px;
    height: 4px;
    background: var(--gold);
    margin: 14px auto 0;
    border-radius: 2px;
}
.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 680px;
    margin: 0 auto 40px;
}
.video-wrap {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #000;
    aspect-ratio: 16 / 9;
}
.video-wrap iframe, .video-wrap video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============ FEATURES ============ */
.features { padding: 70px 0; background: var(--cream-dark); }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}
.feature-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--border);
    transition: all .25s;
}
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--gold); }
.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    background: var(--navy);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feature-icon svg { width: 32px; height: 32px; color: var(--gold-light); }
.feature-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); margin: 0; font-size: .95rem; }

/* ============ PAGE HEADER (inner pages) ============ */
.page-header {
    background:
        linear-gradient(135deg, rgba(10,37,64,.94), rgba(10,37,64,.82));
    color: #fff;
    padding: 56px 0 44px;
    text-align: center;
}
.page-header h1 { color: #fff; font-size: 2.4rem; margin-bottom: 10px; }
.page-header p { color: rgba(255,255,255,.85); font-size: 1.05rem; max-width: 680px; margin: 0 auto; }
.page-header .breadcrumb-hint {
    color: var(--gold-light);
    font-size: .9rem;
    margin-bottom: 14px;
    font-weight: 600;
}

/* ============ ENCYCLOPEDIA / BOOK GRID ============ */
.listing-section { padding: 60px 0; }
.under-preparation { text-align: center; font-size: 2rem; font-weight: 800; color: var(--navy); padding: 60px 0; }
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
}
.card-item {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    color: inherit !important;
}
.card-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}
.card-cover {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.card-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 12px);
}
.card-cover-icon { width: 110px; height: 110px; position: relative; z-index: 1; transition: transform .35s; }
.card-item:hover .card-cover-icon { transform: scale(1.08) rotate(-2deg); }
.card-badge {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    background: rgba(255,255,255,.95);
    color: var(--navy);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 700;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.card-body { padding: 22px 24px 26px; flex: 1; display: flex; flex-direction: column; }
.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 10px;
    line-height: 1.4;
}
.card-desc {
    color: var(--text-muted);
    font-size: .92rem;
    flex: 1;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
}
.card-count {
    color: var(--gold-dark);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.card-link {
    color: var(--navy);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .2s, color .2s;
}
.card-item:hover .card-link { color: var(--gold-dark); gap: 10px; }

.click-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ============ BOOK DETAIL ============ */
.detail-section { padding: 60px 0; }
.detail-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 40px; align-items: start; }
.detail-cover {
    background: #fff;
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 130px;
}
.detail-cover-icon { width: 180px; height: 180px; margin: 0 auto 20px; }
.detail-cover-bg {
    height: 220px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.detail-cover-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 14px);
}
.detail-cover-bg img { width: 130px; height: 130px; position: relative; z-index: 1; }
.detail-info h1 { font-size: 2rem; margin-bottom: 8px; }
.detail-author { color: var(--gold-dark); font-weight: 600; margin-bottom: 18px; }
.detail-desc { color: var(--text-dark); font-size: 1.05rem; line-height: 1.9; margin-bottom: 28px; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.meta-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    border-inline-start: 4px solid var(--gold);
}
.meta-box .meta-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.meta-box .meta-value { font-weight: 700; color: var(--navy); font-size: 1.05rem; margin-top: 4px; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--navy);
    font-weight: 600;
    margin-bottom: 24px;
    padding: 8px 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 30px;
    transition: all .2s;
}
.back-link:hover { background: var(--navy); color: #fff; }
.parent-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--cream-dark);
    border: 1px solid var(--border);
    color: var(--navy);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: 16px;
}
.parent-pill img { width: 22px; height: 22px; }

/* ============ ENCYCLOPEDIA DETAIL ============ */
.enc-detail-header {
    background: linear-gradient(135deg, rgba(10,37,64,.95), rgba(20,54,92,.85));
    color: #fff;
    padding: 60px 0;
}
.enc-detail-header h1 { color: #fff; font-size: 2.4rem; }
.enc-detail-header p { color: rgba(255,255,255,.85); max-width: 720px; }

/* ============ CONTACT ============ */
.contact-section { padding: 60px 0; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; }
.contact-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 32px;
}
.info-row {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: var(--navy);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-light);
}
.info-icon svg { width: 20px; height: 20px; }
.info-content .info-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.info-content .info-value { font-weight: 600; color: var(--navy); margin-top: 2px; }
.info-content .info-value a { color: var(--navy); }
.info-content .info-value a:hover { color: var(--gold-dark); }

.form-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 36px;
}
.form-card h3 { margin-bottom: 6px; font-size: 1.5rem; }
.form-card .form-sub { color: var(--text-muted); margin-bottom: 24px; font-size: .95rem; }
.form-label { font-weight: 600; color: var(--navy); margin-bottom: 6px; font-size: .9rem; }
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,.15);
}
.btn-submit {
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
    transition: all .2s;
}
.btn-submit:hover { background: var(--navy-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.map-section { padding: 0 0 70px; }
.map-wrap {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    line-height: 0;
}
.map-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    font-weight: 700;
    color: var(--navy);
    background: var(--gold);
    padding: 10px 22px;
    border-radius: 10px;
    transition: all .2s;
}
.map-link:hover { background: var(--gold-light); transform: translateY(-2px); }

.alert-success-custom {
    background: #eaf5ec;
    border: 1px solid #b8deba;
    color: #1d5e23;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

/* ============ FOOTER ============ */
.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,.8);
    padding: 60px 0 0;
    margin-top: auto;
    flex-shrink: 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-brand .footer-logo { width: 100px; height: 100px; margin-bottom: 14px; }
.footer-brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.footer-desc { font-size: .92rem; color: rgba(255,255,255,.65); }
.footer-col h5 { color: var(--gold-light); margin-bottom: 16px; font-size: 1rem; font-weight: 700; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: rgba(255,255,255,.75); font-size: .92rem; }
.footer-links a:hover { color: var(--gold-light); padding-inline-start: 4px; }
.footer-contact { list-style: none; padding: 0; margin: 0; }
.footer-contact li { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .92rem; color: rgba(255,255,255,.75); }
.footer-contact svg { color: var(--gold-light); flex-shrink: 0; }
.footer-bottom { padding: 22px 0; text-align: center; }
.footer-bottom p { margin: 0; color: rgba(255,255,255,.7); font-size: .88rem; }

/* ============ NOT FOUND ============ */
.not-found {
    text-align: center;
    padding: 100px 20px;
}
.not-found h1 { font-size: 5rem; color: var(--gold); margin-bottom: 10px; }
.not-found p { color: var(--text-muted); font-size: 1.1rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
    .detail-wrap { grid-template-columns: 1fr; }
    .detail-cover { position: static; }
    .contact-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 30px; }
    .hero h1 { font-size: 2.2rem; }
}

@media (max-width: 768px) {
    .topbar-contact { gap: 14px; }
    .hero { padding: 50px 0 40px; }
    .hero h1 { font-size: 1.8rem; }
    .hero .lead { font-size: 1rem; }
    .section-title { font-size: 1.5rem; }
    .page-header { padding: 40px 0 32px; }
    .page-header h1 { font-size: 1.7rem; }
    .navbar-collapse { padding-top: 14px; }
    .nav-cta { margin-inline-start: 0; margin-top: 8px; text-align: center; }
    .brand-sub { display: none; }
    .grid { grid-template-columns: 1fr; }
    .form-card, .contact-card { padding: 22px; }
}

/* RTL specific tweaks */
[dir=rtl] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }

/* ============ RESEARCH: HERO ============ */
.research-hero { position: relative; background: var(--navy-dark); color: #fff; overflow: hidden; }
.research-hero-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: .2; background-size: cover; background-position: center; }
.research-hero-overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(6,26,48,.2); }
.research-hero-content { position: relative; padding: 80px 0; text-align: center; }
.research-hero h1 { color: #fff; font-size: 2.4rem; font-weight: 800; margin: 0; }
.divider-gold-bar { display: inline-block; width: 64px; height: 3px; background: var(--gold); margin-bottom: 16px; }

/* ============ RESEARCH: LISTING ============ */
.research-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.research-card { display: block; background: #fff; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); text-decoration: none !important; color: inherit !important; transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s cubic-bezier(.4,0,.2,1); }
.research-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.research-card-cover { height: 224px; background: var(--navy-dark); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.research-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.research-card-badge { position: absolute; top: 12px; padding: 4px 12px; background: var(--gold); color: var(--navy-dark); font-size: .75rem; font-weight: 700; border-radius: 4px; }
[dir=rtl] .research-card-badge { left: 12px; }
[dir=ltr] .research-card-badge { right: 12px; }
.research-card-body { padding: 20px; }
.research-card-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); line-height: 1.7; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.research-card-pages { font-size: .75rem; font-weight: 600; color: var(--gold-dark); }

.research-empty { max-width: 720px; margin: 0 auto; background: #fff; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 48px 24px; text-align: center; }
.research-empty-icon { width: 96px; height: 96px; margin: 0 auto 24px; border-radius: 50%; background: #faf6ee; border: 2px solid var(--gold-light); display: flex; align-items: center; justify-content: center; }
.research-empty-icon svg { width: 48px; height: 48px; color: var(--gold-dark); }
.research-empty h2 { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.research-empty p { color: var(--text-muted); margin: 0; }

/* ============ RESEARCH: VIEWER ============ */
.research-viewer-section { background: #eef2f7; padding: 32px 0; min-height: 100vh; }
.research-viewer-wrap { max-width: 900px; margin: 0 auto; }
.research-viewer-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.back-to-research { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); font-weight: 600; text-decoration: none; font-size: .95rem; }
.back-to-research:hover { color: var(--gold-dark); }
.back-to-research svg { width: 20px; height: 20px; flex-shrink: 0; }
.research-viewer-title { font-size: 1.35rem; font-weight: 800; color: var(--navy); margin: 0; }

#viewer { position: relative; background: var(--navy-dark); border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); overflow: hidden; -webkit-user-select: none; user-select: none; }
#viewerStage { position: relative; width: 100%; display: flex; justify-content: center; min-height: 240px; }
#loader { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10; }
.loader-spinner { width: 48px; height: 48px; border: 4px solid var(--gold-light); border-top-color: transparent; border-radius: 50%; animation: research-spin 1s linear infinite; }
@keyframes research-spin { to { transform: rotate(360deg); } }
.loader-text { margin-top: 12px; color: #f8f5f0; font-size: .875rem; font-weight: 500; }
#pageImage { display: block; width: 100%; height: auto; max-height: 85vh; object-fit: contain; background: #04101f; transition: opacity .2s; }

.viewer-nav-side { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; }
.viewer-nav-side-left { left: 0; }
.viewer-nav-side-right { right: 0; }
.viewer-nav-side button { display: flex; padding: 12px; background: rgba(255,255,255,.9); color: var(--navy); border: none; box-shadow: 0 10px 15px -3px rgba(0,0,0,.15); cursor: pointer; transition: background-color .2s, opacity .2s; }
.viewer-nav-side-left button { border-radius: 0 8px 8px 0; }
.viewer-nav-side-right button { border-radius: 8px 0 0 8px; }
.viewer-nav-side button:hover:not(:disabled) { background: #fff; }
.viewer-nav-side button:disabled { opacity: .4; cursor: not-allowed; }
.viewer-nav-side svg { width: 24px; height: 24px; }

#fullscreenBtn { position: absolute; top: 16px; right: 16px; z-index: 20; padding: 8px; background: rgba(255,255,255,.9); color: var(--navy); border: none; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05); cursor: pointer; transition: background-color .2s; }
#fullscreenBtn:hover { background: #fff; }
#fullscreenBtn svg { display: block; width: 24px; height: 24px; }

#pageIndicatorWrap { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: rgba(6,26,48,.8); color: #f8f5f0; padding: 8px 16px; border-radius: 999px; font-size: .875rem; font-weight: 500; }

.viewer-bottom { margin-top: 32px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 16px; }
.research-nav-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; background: var(--navy); color: #fff; border: none; border-radius: 8px; box-shadow: var(--shadow-md); font-weight: 600; text-decoration: none !important; transition: background-color .2s; cursor: pointer; }
.research-nav-btn:hover { background: var(--navy-dark); color: #fff; }
.research-nav-btn-gold { background: var(--gold); color: var(--navy-dark); }
.research-nav-btn-gold:hover { background: var(--gold-dark); color: #fff; }
.research-nav-btn-disabled { background: #d4dde8; color: #6c84a4; box-shadow: var(--shadow-sm); cursor: not-allowed; }
.research-nav-btn-disabled:hover { background: #d4dde8; }
.research-nav-btn-list { background: var(--navy-dark); }
.pager-bar { display: flex; align-items: center; justify-content: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.pager-bar button { display: flex; align-items: center; justify-content: center; padding: 6px; background: #eef2f7; border: none; border-radius: 6px; cursor: pointer; transition: background-color .2s, opacity .2s; }
.pager-bar button:hover:not(:disabled) { background: #d4dde8; }
.pager-bar button:disabled { opacity: .4; cursor: not-allowed; }
.pager-bar img { width: 32px; height: 32px; object-fit: contain; display: block; }
#pageIndicatorBottom { padding: 0 16px; color: var(--navy); font-weight: 600; }
.viewer-list-row { margin-top: 16px; display: flex; justify-content: center; }

/* Viewer fullscreen */
#viewer:fullscreen,
#viewer:-webkit-full-screen { border-radius: 0; }
#viewer:fullscreen #viewerStage,
#viewer:-webkit-full-screen #viewerStage { min-height: 100vh !important; height: 100vh !important; width: 100%; }
#viewer:fullscreen #pageImage,
#viewer:-webkit-full-screen #pageImage { max-height: 100vh !important; max-width: 100vw !important; height: 100vh !important; width: auto !important; }
#viewer:fullscreen #prevBtn,
#viewer:-webkit-full-screen #prevBtn,
#viewer:fullscreen #nextBtn,
#viewer:-webkit-full-screen #nextBtn { position: fixed; top: 50%; transform: translateY(-50%); z-index: 100; background-color: rgba(255,255,255,.95); color: var(--navy); }
#viewer:fullscreen #prevBtn,
#viewer:-webkit-full-screen #prevBtn { left: 1rem; right: auto; }
#viewer:fullscreen #nextBtn,
#viewer:-webkit-full-screen #nextBtn { right: 1rem; left: auto; }

/* ============ CONTROL PANEL ============ */
.cp-section { background: #eef2f7; padding: 32px 0; min-height: 100vh; }
.cp-wrap { max-width: 1150px; margin: 0 auto; }
.cp-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; }
.cp-header h1 { font-size: 1.75rem; font-weight: 800; color: var(--navy); margin: 0; }
.cp-header p { color: var(--text-muted); font-size: .875rem; margin: 4px 0 0; }
.cp-header-user { display: flex; align-items: center; gap: 12px; }
.cp-header-user > span { font-size: .875rem; color: var(--navy); font-weight: 600; }
.cp-logout-btn { padding: 8px 16px; background: var(--navy); color: #fff; border: none; border-radius: 8px; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background-color .2s; }
.cp-logout-btn:hover { background: var(--navy-dark); }

.cp-alert { border-radius: 8px; padding: 12px 16px; font-size: .875rem; margin-bottom: 24px; }
.cp-alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.cp-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

.cp-card { background: #fff; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 32px; }
.cp-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--navy-dark); color: #fff; padding: 16px 24px; }
.cp-card-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.cp-card-header h2 span { color: #a3b3c9; font-size: .85rem; font-weight: 400; }
.cp-card-header .count { font-size: .875rem; color: var(--gold-light); }
.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px; }

.cp-upload { border: 2px dashed #a3b3c9; border-radius: 12px; padding: 24px; background: rgba(238,242,247,.4); text-align: center; }
.cp-upload svg { width: 40px; height: 40px; color: var(--gold); margin-bottom: 8px; }
.cp-upload h3 { font-weight: 700; color: var(--navy); margin-bottom: 4px; font-size: 1rem; }
.cp-upload p { font-size: .75rem; color: var(--text-muted); margin-bottom: 16px; }
.cp-upload input[type=file] { display: block; width: 100%; font-size: .85rem; color: var(--navy); margin-bottom: 16px; }
.cp-upload input[type=file]::file-selector-button { padding: 8px 16px; margin-inline-end: 12px; border: none; border-radius: 8px; background: var(--gold); color: var(--navy-dark); font-weight: 700; cursor: pointer; }
.cp-upload input[type=file]::file-selector-button:hover { background: var(--gold-dark); color: #fff; }
.cp-upload-btn { padding: 10px 24px; background: var(--navy); color: #fff; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: background-color .2s; }
.cp-upload-btn:hover { background: var(--navy-dark); }

.cp-items-title { font-weight: 700; color: var(--navy); margin: 0 0 12px; font-size: 1rem; }
.cp-empty { font-size: .875rem; color: var(--text-muted); font-style: italic; }
.cp-item { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fff; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.cp-item-thumb { width: 64px; height: 80px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: #d4dde8; }
.cp-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-item-main { flex: 1; min-width: 0; }
.cp-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cp-chip { font-size: .75rem; font-weight: 700; color: var(--navy); }
.cp-pages { font-size: .7rem; color: var(--text-muted); }
.cp-title-form { display: flex; gap: 4px; margin-bottom: 6px; }
.cp-title-form input[type=text] { flex: 1; min-width: 0; padding: 4px 8px; font-size: .75rem; border: 1px solid #a3b3c9; border-radius: 6px; outline: none; }
.cp-title-form input[type=text]:focus { border-color: var(--gold); }
.cp-title-form button { padding: 4px 8px; font-size: .7rem; border: none; border-radius: 6px; background: #eef2f7; color: var(--navy); font-weight: 600; cursor: pointer; white-space: nowrap; }
.cp-title-form button:hover { background: #d4dde8; }
.cp-actions { display: flex; gap: 4px; }
.cp-cover-label { flex: 1; text-align: center; font-size: .7rem; font-weight: 600; padding: 4px; border-radius: 6px; background: #faf6ee; color: var(--gold-dark); cursor: pointer; }
.cp-cover-label:hover { background: #f1e6cb; }
.cp-cover-label input[type=file] { display: none; }
.cp-delete-btn { padding: 4px 10px; font-size: .7rem; border: none; border-radius: 6px; background: #fef2f2; color: #dc2626; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cp-delete-btn:hover { background: #fee2e2; }

/* CP Login */
.cp-login-section { background: #eef2f7; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 64px 16px; }
.cp-login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; }
.cp-login-head { background: var(--navy-dark); padding: 32px; text-align: center; }
.cp-login-lock { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: rgba(201,162,39,.2); border: 2px solid var(--gold-light); display: flex; align-items: center; justify-content: center; }
.cp-login-lock svg { width: 32px; height: 32px; color: var(--gold-light); }
.cp-login-head h1 { color: #fff; font-size: 1.5rem; font-weight: 800; margin: 0; }
.cp-login-head p { color: #a3b3c9; font-size: .875rem; margin: 4px 0 0; }
.cp-login-form { padding: 32px; }
.cp-field { margin-bottom: 20px; }
.cp-field label { display: block; font-size: .875rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.cp-field input { width: 100%; padding: 10px 16px; border-radius: 8px; border: 1px solid #a3b3c9; outline: none; transition: border-color .2s, box-shadow .2s; }
.cp-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.2); }
.cp-login-btn { width: 100%; padding: 12px; border: none; border-radius: 8px; background: var(--gold); color: var(--navy-dark); font-weight: 800; cursor: pointer; box-shadow: var(--shadow-md); transition: background-color .2s; }
.cp-login-btn:hover { background: var(--gold-dark); color: #fff; }

/* ============ RESEARCH / CP RESPONSIVE ============ */
@media (min-width: 576px) {
    #viewerStage { min-height: 75vh; }
    #pageImage { width: auto; height: 100%; }
    .viewer-bottom { flex-direction: row; align-items: center; }
}

@media (max-width: 992px) {
    .cp-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .research-hero h1 { font-size: 1.8rem; }
    .pager-bar img { width: 44px; height: 44px; }
}
