:root {
    --bg: #08111f;
    --bg-soft: #0e1728;
    --card: rgba(15, 23, 42, 0.82);
    --card-strong: #111b2e;
    --border: rgba(148, 163, 184, 0.16);
    --text: #e5eefc;
    --muted: #96a4bd;
    --primary: #3b82f6;
    --primary-2: #60a5fa;
    --success: #22c55e;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}


html, body {
    background: var(--bg);
    color: var(--text);
    font-family: "Nokora", "Khmer OS", "Segoe UI", Arial, sans-serif;
    min-height: 100%;
}
body {
    position: relative;
    overflow-x: hidden;
}

.site-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
        radial-gradient(circle at 85% 10%, rgba(59, 130, 246, 0.16), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(14, 165, 233, 0.10), transparent 30%),
        linear-gradient(180deg, #07111f 0%, #091322 40%, #0a1320 100%);
    z-index: -1;
}

a {
    text-decoration: none;
}

.text-secondary {
    color: var(--muted) !important;
}

.app-navbar {
    background: rgba(5, 10, 19, 0.76);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--muted);
}

.navbar .nav-link {
    color: #cfd8e8;
    font-weight: 500;
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    transition: 0.25s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.14);
}

.nav-toggle-btn {
    border: 1px solid var(--border);
    border-radius: 12px;
}

.app-main {
    min-height: calc(100vh - 180px);
}

.hero-section {
    padding: 56px 0 40px;
}

.hero-shell,
.page-hero-card,
.archive-shell,
.control-card,
.results-card,
.feature-card,
.search-panel,
.footer-card {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.hero-shell {
    border-radius: var(--radius-xl);
    padding: 42px;
}

.eyebrow,
.section-kicker {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-2);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
}

.hero-title,
.page-title {
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 18px;
}

.hero-text,
.page-text,
.section-text {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.7;
    max-width: 62ch;
}

.text-gradient {
    background: linear-gradient(90deg, #93c5fd 0%, #60a5fa 50%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(59, 130, 246, 0.10);
    border: 1px solid rgba(96, 165, 250, 0.18);
    color: #dbeafe;
    border-radius: 999px;
    font-size: 0.93rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    background: rgba(8, 17, 31, 0.7);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
}

.stat-label {
    font-size: 0.92rem;
    color: var(--muted);
    margin-top: 4px;
}

.search-panel {
    border-radius: 24px;
    padding: 26px;
}

.search-panel-header {
    margin-bottom: 20px;
}

.form-label-soft {
    color: #d9e6fb;
    font-weight: 600;
    margin-bottom: 8px;
}

.app-input {
    background: rgba(9, 18, 33, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #eef4ff;
    border-radius: 14px;
    min-height: 50px;
    padding-left: 14px;
    padding-right: 14px;
}

.app-input:focus {
    background: rgba(9, 18, 33, 0.98);
    border-color: rgba(59, 130, 246, 0.65);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.18);
}

.app-input::placeholder {
    color: #7f8ea7;
}

.app-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    border: none;
    border-radius: 14px;
    min-height: 52px;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.app-btn-primary:hover {
    background: linear-gradient(135deg, #4f8ef9 0%, #2e6df0 100%);
}

.feature-section,
.archives-section {
    padding: 28px 0 60px;
}

.section-header {
    margin-bottom: 10px;
}

.section-title {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    margin-bottom: 12px;
}

.feature-card {
    border-radius: 22px;
    padding: 26px;
    height: 100%;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.3);
}

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: #fff;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(14, 165, 233, 0.9));
    margin-bottom: 18px;
}

.feature-card h4 {
    font-size: 1.18rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--muted);
    margin-bottom: 0;
    line-height: 1.7;
}

.page-hero {
    padding: 42px 0 18px;
}

.page-hero-sm .page-hero-card {
    padding: 34px;
    border-radius: 24px;
}

.archive-shell {
    border-radius: 28px;
    padding: 26px;
}

.control-card,
.results-card {
    border-radius: 22px;
    padding: 24px;
    height: 100%;
}

.helper-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 16px;
    color: var(--muted);
    font-size: 0.95rem;
}

.results-header {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.results-badge {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 999px;
    color: #dbeafe;
    font-size: 0.9rem;
    white-space: nowrap;
}

.archive-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.archive-file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(9, 18, 33, 0.8);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.archive-file-item:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.24);
}

.file-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(59, 130, 246, 0.18);
    flex-shrink: 0;
}

.file-content {
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: #eef4ff;
    word-break: break-word;
}

.file-meta {
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 44px 18px;
    color: var(--muted);
    border: 1px dashed rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    margin-top: 8px;
}

.empty-state i {
    font-size: 2rem;
    color: var(--primary-2);
    display: inline-block;
    margin-bottom: 10px;
}

.app-footer {
    padding: 0 0 32px;
}

.footer-card {
    border-radius: 22px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.footer-meta {
    white-space: nowrap;
}

.app-alert {
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.khmer-heading {
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .hero-shell,
    .archive-shell,
    .page-hero-card {
        padding: 24px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .results-header,
    .footer-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-meta {
        white-space: normal;
    }
}

@media (max-width: 575.98px) {
    .hero-title,
    .page-title {
        font-size: 2rem;
    }

    .search-panel,
    .control-card,
    .results-card,
    .feature-card {
        padding: 18px;
    }

    .pill {
        width: 100%;
        justify-content: center;
    }
}
.results-section {
    padding-top: 8px;
}

.results-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.results-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.18);
    color: #dbeafe;
    font-weight: 600;
}

.summary-text {
    font-size: 0.96rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.result-card {
    background: rgba(9, 18, 33, 0.84);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.result-card:hover {
    transform: translateY(-3px);
    border-color: rgba(96, 165, 250, 0.28);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.result-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.result-index {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(14, 165, 233, 0.95));
    color: #fff;
    font-weight: 800;
    flex-shrink: 0;
}

.result-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.14);
    color: #d8e8ff;
    font-size: 0.9rem;
}

.result-preview {
    margin-bottom: 18px;
}

.result-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #f2f7ff;
}

.result-snippet-btn {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: #d9e5f7;
    border-radius: 16px;
    padding: 16px 18px;
    line-height: 1.75;
    font-size: 0.98rem;
    transition: 0.2s ease;
}

.result-snippet-btn:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(96, 165, 250, 0.22);
    color: #fff;
}

.result-source {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.source-row {
    display: grid;
    gap: 8px;
}

.source-label {
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
}

.source-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    padding: 14px 16px;
    color: #cfe2ff;
    transition: 0.2s ease;
    word-break: break-word;
}

.source-link:hover {
    color: #fff;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(96, 165, 250, 0.22);
}

.source-arrow {
    flex-shrink: 0;
    opacity: 0.85;
}

.result-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.empty-state-lg {
    padding: 60px 22px;
}

@media (max-width: 767.98px) {
    .results-shell {
        padding: 18px;
    }

    .result-card {
        padding: 16px;
    }

    .source-link {
        align-items: flex-start;
    }
}
body, button, input, select, textarea, .btn, .form-control, .form-select, .navbar, .nav-link {
    font-family: "Nokora", "Khmer OS", "Segoe UI", Arial, sans-serif !important;
}

h1, h2, h3, h4, h5, h6, .brand-title, .page-title, .hero-title, .section-title {
    font-family: "Nokora", "Khmer OS", "Segoe UI", Arial, sans-serif;
    font-weight: 700;
}

.text-viewer-section {
    padding-top: 8px;
}

.text-viewer-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.text-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.text-viewer-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.reading-card {
    background: rgba(9, 18, 33, 0.84);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
}

.reading-card-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.reading-content {
    padding: 24px 22px;
    color: #e7eefb;
    line-height: 2;
    font-size: 1.02rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.reading-content p {
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .text-viewer-shell {
        padding: 18px;
    }

    .reading-card-header,
    .reading-content {
        padding-left: 16px;
        padding-right: 16px;
    }
}

.image-viewer-section {
    padding-top: 8px;
}

.image-viewer-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.image-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.image-viewer-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.image-stage-card {
    background: rgba(9, 18, 33, 0.84);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
}

.image-stage-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.image-stage-body {
    padding: 20px;
}

.image-frame {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(5, 10, 19, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 420px;
}

.document-preview-image {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
    background: #fff;
}

@media (max-width: 767.98px) {
    .image-viewer-shell {
        padding: 18px;
    }

    .image-stage-header,
    .image-stage-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .image-frame {
        min-height: 260px;
        padding: 12px;
    }

    .document-preview-image {
        max-height: 62vh;
    }
}

.pdf-viewer-section {
    min-height: calc(100vh - 120px);
}

.pdf-viewer-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.pdf-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.pdf-viewer-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pdf-viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pdf-stage-card {
    background: rgba(9, 18, 33, 0.84);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
}

.pdf-stage-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.pdf-stage-body {
    padding: 16px;
}

.pdf-frame-wrap {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
        rgba(5, 10, 19, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 18px;
    padding: 10px;
    min-height: 78vh;
}

.pdf-frame {
    width: 100%;
    height: 78vh;
    border: none;
    border-radius: 12px;
    background: #fff;
}

@media (max-width: 991.98px) {
    .pdf-frame-wrap,
    .pdf-frame {
        min-height: 72vh;
        height: 72vh;
    }
}

@media (max-width: 767.98px) {
    .pdf-viewer-shell {
        padding: 14px;
    }

    .pdf-stage-body {
        padding: 12px;
    }

    .pdf-frame-wrap,
    .pdf-frame {
        min-height: 68vh;
        height: 68vh;
    }
}
.about-section {
    padding-top: 8px;
}

.about-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.about-card,
.about-side-card,
.mini-feature-card {
    background: rgba(9, 18, 33, 0.84);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.about-card,
.about-side-card {
    padding: 24px;
}

.about-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #f3f8ff;
}

.about-text {
    color: var(--muted);
    line-height: 1.85;
    margin-bottom: 0.95rem;
}

.mini-feature-card {
    padding: 20px;
    height: 100%;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.mini-feature-card:hover {
    transform: translateY(-3px);
    border-color: rgba(96, 165, 250, 0.24);
}

.mini-feature-card h5 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #eef5ff;
}

.mini-feature-card p {
    color: var(--muted);
    margin-bottom: 0;
    line-height: 1.7;
}

.about-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.about-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #dce8fa;
}

.about-list li i {
    color: var(--primary-2);
    flex-shrink: 0;
    margin-top: 3px;
}

.about-contact-links {
    display: grid;
    gap: 12px;
}

@media (max-width: 767.98px) {
    .about-shell {
        padding: 18px;
    }

    .about-card,
    .about-side-card,
    .mini-feature-card {
        padding: 18px;
    }

    .about-title {
        font-size: 1.25rem;
    }
}
