/* ── Google Font ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design tokens ── */
:root {
    --brand-dark:   #1B2A4A;
    --brand-mid:    #243660;
    --brand-accent: #2E6BE6;
    --brand-gold:   #E8A020;
    --bg-page:      #F0F4F8;
    --bg-card:      #FFFFFF;
    --text-primary: #1a1d2e;
    --text-muted:   #6c757d;
    --border:       #dde3ed;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:    0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    --radius:       0.6rem;
    --radius-sm:    0.4rem;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.925rem;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ── Navbar ── */
.navbar {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-mid) 100%) !important;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    min-height: 60px;
}

.navbar .container {
    min-height: 60px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.navbar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--brand-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.navbar-brand .brand-sub {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.65;
    display: block;
    line-height: 1;
    margin-top: 1px;
}

.nav-link {
    color: rgba(255,255,255,0.78) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 1.1rem 0.85rem !important;
    transition: color 0.15s ease;
    border-bottom: 2px solid transparent;
}

.nav-link:hover, .nav-link:focus {
    color: #fff !important;
    border-bottom-color: var(--brand-gold);
}

.nav-link .bi { font-size: 0.85rem; }

.navbar-toggler {
    border-color: rgba(255,255,255,0.3);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 0.4rem;
    min-width: 200px;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.12s ease;
}

.dropdown-item:hover {
    background-color: #EEF2FF;
    color: var(--brand-accent);
}

.navbar .badge {
    font-size: 0.6rem;
    padding: 0.25em 0.5em;
    background: var(--brand-gold) !important;
    color: #1a1a1a !important;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ── Flash messages ── */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* ── Cards ── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

/* ── Search page ── */
.search-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.search-hero h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
}

.search-hero .form-control {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: 1.05rem;
    height: 48px;
    box-shadow: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-hero .form-control:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(46,107,230,0.12);
}

.search-hero .btn-primary {
    height: 48px;
    padding: 0 1.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

/* ── Catalog grid ── */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.1rem;
}

.catalog-card {
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius) !important;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid var(--border) !important;
}

.catalog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
    color: inherit;
    text-decoration: none;
}

.catalog-card .card-img-top {
    object-fit: contain;
    background: #f7f8fa;
    height: 190px;
    border-bottom: 1px solid var(--border);
}

.catalog-card .card-body {
    padding: 0.65rem 0.85rem 0.75rem;
}

.catalog-card .card-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-card .card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ── Buttons ── */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
}

.btn-primary:hover {
    background: #1d5bcc;
    border-color: #1d5bcc;
}

.btn-sm { font-size: 0.8rem; }

/* ── Image detail ── */
.image-detail-img {
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
    background: #f7f8fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    display: block;
    width: 100%;
}

.detail-meta dt {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-meta dd {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.65rem;
}

/* ── Notes ── */
.note-card {
    border-left: 3px solid var(--brand-accent) !important;
    border-radius: var(--radius-sm) !important;
    background: #fafbff;
}

.note-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--brand-accent);
}

.note-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-body {
    font-size: 0.875rem;
    white-space: pre-wrap;
    margin: 0;
    color: var(--text-primary);
}

/* ── Upload zone ── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: #fafbff;
    transition: border-color 0.15s;
}

.upload-zone:focus-within {
    border-color: var(--brand-accent);
}

/* ── Forms ── */
.form-control, .form-select {
    border-color: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(46,107,230,0.12);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #444;
    margin-bottom: 0.35rem;
}

/* ── Login page ── */
.login-page {
    min-height: 100vh;
    display: flex;
}

.login-brand-panel {
    background: linear-gradient(160deg, var(--brand-dark) 0%, var(--brand-mid) 60%, #1e4a8a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    color: #fff;
    text-align: center;
}

.login-brand-panel .brand-logo {
    width: 72px;
    height: 72px;
    background: var(--brand-accent);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.login-brand-panel h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-brand-panel p {
    font-size: 0.9rem;
    opacity: 0.65;
    max-width: 220px;
    line-height: 1.5;
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--bg-page);
}

.login-form-box {
    width: 100%;
    max-width: 380px;
}

.login-form-box h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
    font-size: 0.8rem;
    font-weight: 500;
}

.breadcrumb-item a {
    color: var(--brand-accent);
    text-decoration: none;
}

.breadcrumb-item a:hover { text-decoration: underline; }

/* ── Pagination ── */
.page-link {
    border-color: var(--border);
    color: var(--brand-accent);
    font-size: 0.875rem;
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
}

.page-item.active .page-link {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
}

/* ── Section headers ── */
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ── Tables ── */
.table th {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.table td { font-size: 0.875rem; vertical-align: middle; }

/* ── DO NOT USE ── */
.dnu-image { filter: brightness(0.45); }

.dnu-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.dnu-overlay-text {
    color: #fff;
    font-size: clamp(1.6rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(180, 0, 0, 0.78);
    padding: 0.3em 0.7em;
    border-radius: 0.4em;
    border: 3px solid rgba(255,255,255,0.8);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transform: rotate(-8deg);
}

.dnu-thumb { filter: brightness(0.45); }

.dnu-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: rgba(160, 0, 0, 0.6);
    pointer-events: none;
}

/* ── Category pills ── */
.category-pill {
    display: inline-block;
    padding: 0.35em 0.85em;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: background 0.13s, border-color 0.13s, color 0.13s;
    white-space: nowrap;
}

.category-pill:hover {
    background: #EEF2FF;
    border-color: var(--brand-accent);
    color: var(--brand-accent);
    text-decoration: none;
}

.category-pill.active {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #fff;
}

/* ── Empty state ── */
.empty-state { padding: 4rem 1rem; text-align: center; }
.empty-state .empty-icon {
    font-size: 3rem;
    color: #c8d0e0;
    margin-bottom: 1rem;
    display: block;
}
.empty-state p { color: var(--text-muted); font-size: 0.95rem; }
