/* =====================================================================
   مكتبة بغداد الرقمية — modern theme
   Colours from the banner: teal title, dark teal subtitle, gold ring of
   the department emblem. Soft curves, glossy gradients, glass cards.
   ===================================================================== */

@font-face {
    font-family: "PT Bold Heading Web";
    src: local("PT Bold Heading"), local("PTBoldHeading"), local("PT Bold Heading Regular"),
         url("/fonts/PT-Bold-Heading.ttf") format("truetype");
    font-display: swap;
}

:root {
    --lib-teal:        #1b6670;
    --lib-teal-dark:   #0f505b;
    --lib-teal-deep:   #0a3a42;
    --lib-teal-light:  #5497aa;
    --lib-teal-pale:   #e3f0f1;
    --lib-sage:        #c9d1bf;
    --lib-gold:        #c2a15f;
    --lib-gold-light:  #e7d3a1;
    --lib-brown:       #4e3c3b;
    --lib-bg:          #f3f7f6;
    --lib-text:        #1f2d2f;
    --r-xl: 2rem; --r-lg: 1.4rem; --r-md: 1rem; --r-sm: .7rem; --r-pill: 50rem;
    --shadow-sm: 0 2px 8px rgba(10, 58, 66, .06);
    --shadow:    0 10px 30px -12px rgba(10, 58, 66, .25);
    --shadow-lg: 0 24px 50px -20px rgba(10, 58, 66, .35);
    --gloss: linear-gradient(180deg, rgba(255,255,255,.35) 0%, rgba(255,255,255,.08) 48%, rgba(255,255,255,0) 52%);
    --heading-font: "PT Bold Heading Web", "Cairo", "Segoe UI", Tahoma, sans-serif;
    --body-font:    "Cairo", "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
}

html { font-size: 15px; position: relative; min-height: 100%; scroll-behavior: smooth; }
body {
    font-family: var(--body-font);
    color: var(--lib-text);
    margin-bottom: 150px;
    background:
        radial-gradient(900px 500px at 100% -10%, rgba(84, 151, 170, .14), transparent 60%),
        radial-gradient(700px 400px at -10% 30%, rgba(194, 161, 95, .10), transparent 60%),
        var(--lib-bg);
    background-attachment: fixed;
}
::selection { background: rgba(27, 102, 112, .22); }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
.main-nav .nav-link, .stat-card .num, .btn, th, .page-link, .badge, .hero-stats b {
    font-family: var(--heading-font);
    font-weight: normal;
}
h1, h2, h3, .h1, .h2, .h3, .h4, .h5 { color: var(--lib-teal-dark); }
a { color: var(--lib-teal); }
a:hover { color: var(--lib-teal-dark); }

/* ---------------------------------------------------------------- header */
/* department emblem on the right, site name in the middle, governorate emblem on the left,
   on a soft pearl band that ends in a flowing teal and gold curve */
.site-head {
    position: relative; overflow: hidden; isolation: isolate;
    padding: 1.3rem 0 3.6rem;
    background:
        radial-gradient(420px 220px at 92% 30%, rgba(84,151,170,.16), transparent 70%),
        radial-gradient(420px 220px at 8% 40%, rgba(194,161,95,.14), transparent 70%),
        linear-gradient(180deg, #ffffff 0%, #f6fafa 100%);
}
.head-orb { position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; }
.orb-1 { width: 300px; height: 300px; right: -90px; top: -150px; border: 1.5px solid rgba(27,102,112,.12); }
.orb-1::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; border: 1px dashed rgba(194,161,95,.35); }
.orb-2 { width: 240px; height: 240px; left: -80px; bottom: -150px; border: 1.5px solid rgba(194,161,95,.22); }
.head-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.head-logo { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.head-logo img { display: block; height: auto; transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .5s; }
.head-logo:hover img { transform: translateY(-3px) scale(1.03); }
.head-dept img {
    width: 108px; border-radius: 50%;
    box-shadow: 0 0 0 5px #fff, 0 0 0 6px rgba(194,161,95,.55), 0 14px 28px -10px rgba(10,58,66,.45);
}
.head-gov img { height: 100px; width: auto; filter: drop-shadow(0 8px 14px rgba(10,58,66,.12)); }

.head-title { flex: 1 1 auto; text-align: center; text-decoration: none; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.head-kicker {
    display: inline-flex; align-items: center; gap: .6rem; font-size: .88rem; font-weight: 600;
    color: var(--lib-teal); letter-spacing: .01em; margin-bottom: .15rem;
}
.head-kicker i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--lib-gold); display: inline-block; }
.head-name {
    font-family: var(--heading-font); font-size: clamp(1.8rem, 4vw, 3.3rem); line-height: 1.25;
    background: linear-gradient(100deg, var(--lib-teal-deep) 10%, var(--lib-teal) 45%, var(--lib-teal-light) 60%, var(--lib-teal-deep) 90%);
    background-size: 220% 100%; background-position: 0 0;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 3px 6px rgba(10,58,66,.12));
    transition: background-position 1.2s ease;
}
.head-title:hover .head-name { background-position: 100% 0; }
.head-tag { display: inline-flex; align-items: center; gap: .7rem; color: #6b7d7f; font-size: .92rem; margin-top: .1rem; }
.head-tag b { display: inline-block; width: 46px; height: 1.5px; border-radius: 2px; }
.head-tag b:first-child { background: linear-gradient(90deg, var(--lib-gold), transparent); }
.head-tag b:last-child  { background: linear-gradient(270deg, var(--lib-gold), transparent); }
.head-curve { position: absolute; left: 0; bottom: -1px; width: 100%; height: 64px; }
.head-curve .hc-fill { fill: var(--lib-bg); }
@media (max-width: 767.98px) {
    .site-head { padding: .8rem 0 2.6rem; }
    .head-curve { height: 40px; }
    .head-inner { gap: .5rem; }
    .head-dept img { width: 58px; box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(194,161,95,.55), 0 8px 16px -8px rgba(10,58,66,.45); }
    .head-gov img { height: 52px; }
    .head-kicker, .head-tag { display: none; }
    .head-name { font-size: 1.35rem; }
    .orb-1, .orb-2 { display: none; }
}

.nav-wrap { position: relative; z-index: 20; margin-top: -1.9rem; margin-bottom: 1.6rem; }
.has-hero .nav-wrap { margin-bottom: -2.2rem; }       /* the menu floats over the top of the hero */
.main-nav {
    border-radius: var(--r-pill);
    background: var(--gloss), linear-gradient(120deg, var(--lib-teal-deep), var(--lib-teal) 55%, var(--lib-teal-light));
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.12);
    border: 1px solid rgba(255,255,255,.25);
    padding: .45rem .8rem;
}
.main-nav.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.92); font-size: 1.02rem; padding: .45rem .95rem !important;
    border-radius: var(--r-pill); transition: background .2s, color .2s;
}
.main-nav.navbar-dark .navbar-nav .nav-link:hover,
.main-nav.navbar-dark .navbar-nav .nav-link:focus,
.main-nav.navbar-dark .navbar-nav .show > .nav-link {
    color: #fff; background: rgba(255,255,255,.16);
}
.main-nav .navbar-toggler { border-radius: var(--r-pill); border-color: rgba(255,255,255,.4); }
.main-nav .dropdown-menu {
    font-family: var(--body-font); border: 0; border-radius: var(--r-md); padding: .5rem;
    box-shadow: var(--shadow-lg); margin-top: .6rem;
}
.main-nav .dropdown-item { border-radius: var(--r-sm); padding: .45rem .9rem; }
.main-nav .dropdown-item:hover { background: var(--lib-teal-pale); color: var(--lib-teal-dark); }
.main-nav .dropdown-item:active { background: var(--lib-teal); color: #fff; }
@media (max-width: 991.98px) {
    .main-nav { border-radius: var(--r-lg); }
    .has-hero .nav-wrap { margin-bottom: 1rem; }
}

/* ---------------------------------------------------------------- hero */
.hero {
    position: relative; overflow: hidden; color: #fff;
    padding: 5.5rem 0 7rem;
    background:
        radial-gradient(600px 300px at 15% 20%, rgba(194, 161, 95, .35), transparent 60%),
        radial-gradient(500px 300px at 90% 80%, rgba(84, 151, 170, .55), transparent 60%),
        linear-gradient(135deg, var(--lib-teal-deep) 0%, var(--lib-teal-dark) 45%, var(--lib-teal) 100%);
}
.hero-glow {
    position: absolute; inset: auto -10% -40% auto; width: 520px; height: 520px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); pointer-events: none;
}
.hero::before, .hero::after {
    content: ""; position: absolute; border-radius: 50%; border: 2px solid rgba(231, 211, 161, .25); pointer-events: none;
}
.hero::before { width: 380px; height: 380px; left: -120px; top: -140px; }
.hero::after  { width: 220px; height: 220px; right: 8%; top: 18%; border-color: rgba(255,255,255,.12); }
.hero-title { color: #fff; font-size: clamp(1.7rem, 3.6vw, 2.8rem); margin-bottom: .6rem; text-shadow: 0 2px 12px rgba(0,0,0,.18); }
.hero-sub { color: rgba(255,255,255,.85); font-size: 1.1rem; margin-bottom: 1.8rem; }
.hero-wave { position: absolute; bottom: -1px; left: 0; width: 100%; height: 90px; }
.hero-wave path { fill: var(--lib-bg); }

.search-pill {
    display: flex; align-items: center; gap: .4rem; background: #fff; border-radius: var(--r-pill);
    padding: .4rem; box-shadow: 0 20px 40px -15px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.6);
    max-width: 860px;
}
.search-pill input, .search-pill select {
    border: 0; outline: 0; background: transparent; font-size: 1.08rem; padding: .6rem 1rem; color: var(--lib-text); min-width: 0;
}
.search-pill input { flex: 1 1 auto; }
.search-pill select { flex: 0 0 210px; border-inline-start: 1px solid #e3ebea; border-radius: 0; }
.search-pill .btn { padding: .65rem 2rem; font-size: 1.05rem; }
@media (max-width: 767.98px) {
    .search-pill { flex-wrap: wrap; border-radius: var(--r-lg); }
    .search-pill input, .search-pill select { flex: 1 1 100%; border: 0; }
    .search-pill .btn { width: 100%; }
}
.adv-toggle {
    background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--r-pill); padding: .3rem 1rem; margin-top: .9rem; font-size: .95rem; transition: background .2s;
}
.adv-toggle:hover { background: rgba(255,255,255,.22); }
.adv-toggle .chev { display: inline-block; transition: transform .25s; }
.adv-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.glass .adv-toggle, .page-body .adv-toggle { background: var(--lib-teal-pale); color: var(--lib-teal-dark); border-color: transparent; }
.hero .glass { color: var(--lib-text); max-width: 860px; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.2rem; }
.hero-stats > div {
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: var(--r-lg);
    padding: .7rem 1.3rem; backdrop-filter: blur(6px); min-width: 130px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.hero-stats b { display: block; font-size: 1.7rem; color: var(--lib-gold-light); line-height: 1.2; }
.hero-stats span { font-size: .9rem; color: rgba(255,255,255,.85); }

/* ---------------------------------------------------------------- feature cards */
.features { margin-top: -1rem; }
.feature {
    display: block; height: 100%; padding: 2rem 1.6rem; border-radius: var(--r-xl); text-decoration: none; color: var(--lib-text);
    background: linear-gradient(160deg, #fff 0%, #f7fbfb 100%); box-shadow: var(--shadow);
    border: 1px solid rgba(27, 102, 112, .08); position: relative; overflow: hidden; transition: transform .25s, box-shadow .25s;
}
.feature::after {
    content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%; left: -70px; bottom: -90px;
    background: radial-gradient(circle, rgba(194, 161, 95, .18), transparent 70%);
}
.feature:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); color: var(--lib-text); }
.feature h3 { font-size: 1.3rem; margin: 1rem 0 .5rem; }
.feature p { color: #5b6b6d; margin: 0; }
.feature-icon {
    width: 64px; height: 64px; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 1.9rem;
    background: var(--gloss), linear-gradient(135deg, var(--lib-teal), var(--lib-teal-light));
    box-shadow: 0 10px 20px -8px rgba(27, 102, 112, .6);
}

/* ---------------------------------------------------------------- buttons */
.btn { border-radius: var(--r-pill); padding-inline: 1.2rem; transition: transform .15s, box-shadow .2s, background-color .2s; position: relative; overflow: hidden; }
.btn-sm { padding-inline: .9rem; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-success, .btn-secondary { border: 0; color: #fff; }
.btn-primary {
    background: var(--gloss), linear-gradient(135deg, var(--lib-teal-light), var(--lib-teal) 45%, var(--lib-teal-dark));
    box-shadow: 0 8px 18px -8px rgba(27, 102, 112, .7), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    color: #fff; background: var(--gloss), linear-gradient(135deg, var(--lib-teal), var(--lib-teal-dark) 60%, var(--lib-teal-deep));
    box-shadow: 0 12px 22px -8px rgba(27, 102, 112, .8), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-success {
    background: var(--gloss), linear-gradient(135deg, #4da37e, #2f7d5b 50%, #24634a);
    box-shadow: 0 8px 18px -8px rgba(47, 125, 91, .7), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-success:hover, .btn-success:focus { color: #fff; background: var(--gloss), linear-gradient(135deg, #2f7d5b, #24634a); }
.btn-secondary {
    background: var(--gloss), linear-gradient(135deg, #7a605d, var(--lib-brown) 55%, #3a2c2b);
    box-shadow: 0 8px 18px -8px rgba(78, 60, 59, .7), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-secondary:hover, .btn-secondary:focus { color: #fff; background: var(--gloss), linear-gradient(135deg, var(--lib-brown), #2d2221); }
/* shine that sweeps across glossy buttons on hover */
.btn-primary::after, .btn-success::after, .btn-secondary::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg);
    transition: left .55s;
}
.btn-primary:hover::after, .btn-success:hover::after, .btn-secondary:hover::after { left: 130%; }
.btn-outline-primary { color: var(--lib-teal); border: 1.5px solid var(--lib-teal); background: #fff; }
.btn-outline-primary:hover, .btn-outline-primary:active { color: #fff; background: var(--lib-teal); border-color: var(--lib-teal); }
.btn-outline-secondary { border-radius: var(--r-pill); border-color: #c9d6d6; color: #4f6466; background: #fff; }
.btn-outline-secondary:hover { background: var(--lib-teal-pale); color: var(--lib-teal-dark); border-color: var(--lib-teal-pale); }
.btn-outline-success { color: #2f7d5b; border-color: #2f7d5b; }
.btn-outline-success:hover { color: #fff; background: #2f7d5b; }
.btn-outline-danger { border-radius: var(--r-pill); }
.btn-light { background: #fff; border: 1px solid #e3ebea; }
.btn:focus-visible { box-shadow: 0 0 0 .25rem rgba(27, 102, 112, .3) !important; }

/* ---------------------------------------------------------------- forms */
.form-control, .form-select { border-radius: var(--r-sm); border-color: #d5e0e0; padding-block: .5rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--lib-teal-light); box-shadow: 0 0 0 .22rem rgba(27, 102, 112, .15);
}
.form-control-lg, .form-select-lg { border-radius: var(--r-pill); }
.form-check-input:checked { background-color: var(--lib-teal); border-color: var(--lib-teal); }
.form-switch .form-check-input { border-radius: var(--r-pill); }
textarea.form-control { border-radius: var(--r-md); }

/* ---------------------------------------------------------------- surfaces */
.glass {
    background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.7); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.bg-white.rounded, .bg-white.rounded.shadow-sm, .search-hero {
    border-radius: var(--r-lg) !important; box-shadow: var(--shadow) !important; border: 1px solid rgba(27, 102, 112, .06);
}
.search-hero { background: linear-gradient(160deg, #fff, #f6fbfb); padding: 2rem; position: relative; overflow: hidden; }
.search-hero::before {
    content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; left: -90px; top: -120px;
    background: radial-gradient(circle, rgba(84, 151, 170, .18), transparent 70%);
}
.stat-card {
    background: linear-gradient(160deg, #fff, #f5faf9); border-radius: var(--r-lg); padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow); border: 1px solid rgba(27, 102, 112, .06); position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--lib-gold), var(--lib-gold-light), var(--lib-teal-light));
}
.stat-card.warn { box-shadow: 0 0 0 2px #e8b4a8, var(--shadow-sm); }
.stat-card.warn .num { color: #b5523b; }
a:hover > .stat-card { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .num { font-size: 2.1rem; color: var(--lib-teal); line-height: 1.2; }

/* tables live in rounded cards */
.table-responsive.bg-white, .table-card {
    border-radius: var(--r-lg) !important; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    background: #fff; box-shadow: var(--shadow);
    border: 1px solid rgba(27, 102, 112, .06);
}
.table { --bs-table-hover-bg: rgba(84, 151, 170, .08); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem .9rem; border-bottom-color: #edf2f2; }
.table-light, .table > thead.table-light th {
    --bs-table-bg: transparent; background: linear-gradient(180deg, #eef6f6, var(--lib-teal-pale)) !important;
    color: var(--lib-teal-dark); border-color: #d9e8e9;
}
.table-hover > tbody > tr:hover { --bs-table-accent-bg: rgba(84, 151, 170, .09); }
.table-danger { --bs-table-bg: #fbe9ea; }

.badge { border-radius: var(--r-pill); padding: .4em .8em; font-size: .78rem; }
.badge-available { background: linear-gradient(135deg, #4da37e, #2f7d5b); }
.badge-borrowed  { background: linear-gradient(135deg, #d39b3c, #b07a1e); }

.alert { border-radius: var(--r-md); border: 0; box-shadow: var(--shadow-sm); }
.list-group-item:first-child { border-top-left-radius: var(--r-sm); border-top-right-radius: var(--r-sm); }
.list-group-item:last-child { border-bottom-left-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); }

.pagination { gap: .35rem; }
.page-link { border-radius: 50% !important; min-width: 2.4rem; height: 2.4rem; display: flex; align-items: center; justify-content: center;
             color: var(--lib-teal); border: 0; background: #fff; box-shadow: var(--shadow-sm); }
.page-item:first-child .page-link, .page-item:last-child .page-link { border-radius: var(--r-pill) !important; padding-inline: 1rem; }
.page-link:hover { background: var(--lib-teal-pale); color: var(--lib-teal-dark); }
.page-item.active .page-link { background: linear-gradient(135deg, var(--lib-teal-light), var(--lib-teal-dark)); color: #fff; }
.page-item.disabled .page-link { background: #f1f4f4; }

/* ---------------------------------------------------------------- footer */
.footer { position: absolute; bottom: 0; width: 100%; color: rgba(255,255,255,.82); background: var(--lib-teal-deep); }
.footer-wave { position: absolute; top: -58px; left: 0; width: 100%; height: 60px; }
.footer-wave path { fill: var(--lib-teal-deep); }

/* ---------------------------------------------------------------- details, rows */
tr[data-href] { cursor: pointer; }
tr[data-href]:focus { outline: 2px solid var(--lib-teal); outline-offset: -2px; }
.details dt { color: #6c7a7c; font-weight: normal; }
.details dd { font-weight: 600; margin-bottom: .8rem; }
.research-card { border-radius: var(--r-lg) !important; transition: transform .2s, box-shadow .2s; }
.research-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg) !important; }
img.rounded, .rounded.border { border-radius: var(--r-md) !important; }

/* ---------------------------------------------------------------- rare books gallery */
.rare-card { border-radius: var(--r-lg) !important; transition: transform .25s, box-shadow .25s; }
.rare-card:hover { transform: translateY(-6px) rotate(-.3deg); box-shadow: var(--shadow-lg) !important; }
.rare-cover { aspect-ratio: 3 / 4; background: #ede6d6; border-bottom: 3px solid var(--lib-gold); }
.rare-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rare-cover-empty {
    height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
    font-family: var(--heading-font); color: var(--lib-brown); font-size: 1.05rem;
    background: repeating-linear-gradient(45deg, #efe8d8, #efe8d8 8px, #e8dfca 8px, #e8dfca 16px);
}

/* ---------------------------------------------------------------- print (loan slip) */
.print-banner { display: none; }
@media print {
    header, footer, .no-print { display: none !important; }
    body { background: #fff; margin: 0; }
    .print-banner { display: block; max-width: 100%; max-height: 90px; margin: 0 auto 1rem; }
    .slip { box-shadow: none !important; padding: 0 !important; border: 0 !important; }
    a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- reports */
.report-list { position: sticky; top: 1rem; }
.report-link { display: block; padding: .45rem .7rem; border-radius: var(--r-sm); color: var(--lib-text); text-decoration: none; font-size: .93rem; }
.report-link:hover { background: var(--lib-teal-pale); color: var(--lib-teal-dark); }
.col-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: var(--r-pill);
        background: #f1f6f6; border: 1px solid #dde9e9; cursor: pointer; font-size: .9rem; user-select: none; }
.chip:has(input:checked) { background: linear-gradient(135deg, var(--lib-teal-light), var(--lib-teal)); color: #fff; border-color: transparent; }
.chip input { accent-color: var(--lib-teal); }
.btn-check:checked + .btn-outline-primary { color: #fff; background: linear-gradient(135deg, var(--lib-teal-light), var(--lib-teal-dark)); border-color: var(--lib-teal); }
.report-table .group1 td { background: linear-gradient(90deg, var(--lib-teal-pale), #f6fbfb) !important; color: var(--lib-teal-dark); font-size: 1.02rem; }
.report-table .group2 td { background: #fbf8f0 !important; padding-inline-start: 2rem; }
.report-table .count, .group1 .count { display: inline-block; margin-inline-start: .5rem; padding: .05rem .6rem; border-radius: var(--r-pill);
        background: var(--lib-gold); color: #fff; font-size: .8rem; }
.bar { flex: 1; height: 10px; border-radius: var(--r-pill); background: #edf3f3; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--lib-teal-light), var(--lib-teal)); }
tfoot td { background: #f6fafa; }
@media print {
    .report-paper .table-card { box-shadow: none !important; border: 1px solid #ccc; }
    .report-table .group1 td, .report-table .group2 td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .col-lg-9 { width: 100% !important; }
}

/* ---------------------------------------------------------------- import */
.import-steps { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.import-steps li { display: flex; align-items: center; gap: .5rem; padding: .35rem 1rem .35rem .45rem; border-radius: var(--r-pill);
                   background: #fff; box-shadow: var(--shadow-sm); color: #7a8a8c; font-weight: 600; }
.import-steps li span { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: #edf3f3; font-family: var(--heading-font); }
.import-steps li.active { color: var(--lib-teal-dark); box-shadow: 0 0 0 2px var(--lib-teal-light), var(--shadow-sm); }
.import-steps li.active span { background: linear-gradient(135deg, var(--lib-teal), var(--lib-teal-light)); color: #fff; }
.import-steps li.done span { background: var(--lib-gold); color: #fff; }
.map-table { max-height: 520px; }
.map-table table { font-size: .88rem; }
.map-table th { min-width: 170px; background: #f6f9f9; vertical-align: top; position: sticky; top: 0; z-index: 1; }
.map-table th.mapped { background: var(--lib-teal-pale); box-shadow: inset 0 -3px 0 var(--lib-teal-light); }
.map-table .file-head td { background: #fbf8f0; font-weight: 700; color: var(--lib-brown); }
.map-table td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- dashboard: library cards and charts */
:root {
    --chart-1:     #00939b;   /* the single series colour (validated: chroma, lightness band, contrast) */
    --chart-1-hi:  #007a81;   /* hover */
    --chart-ref:   #b8913f;   /* reference marker (reported totals) */
    --chart-track: #edf3f3;
    --chart-grid:  #e3eaea;
}
.lib-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 1rem 1.2rem; height: 100%;
            border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--lib-gold), var(--lib-teal-light)) 1; }
.lib-card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.lib-card-name { font-family: var(--heading-font); font-size: 1.15rem; color: var(--lib-teal-dark); text-decoration: none; }
.lib-card-name:hover { color: var(--lib-teal); text-decoration: underline; }
.lib-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; }
.lib-stats > div { background: #f6f9f9; border-radius: var(--r-sm); padding: .45rem .3rem; text-align: center; }
.lib-stats b { display: block; font-family: var(--heading-font); font-weight: normal; font-size: 1.25rem; color: var(--lib-teal); line-height: 1.2; }
.lib-stats span { font-size: .74rem; color: #637477; }
.lib-card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; margin-top: .6rem; font-size: .82rem; color: #637477; }
@media (max-width: 575.98px) { .lib-stats { grid-template-columns: repeat(3, 1fr); } }

.period-pills { display: inline-flex; background: #fff; border-radius: var(--r-pill); box-shadow: var(--shadow-sm); padding: .25rem; gap: .2rem; flex-wrap: wrap; }
.period-pills a { padding: .3rem .9rem; border-radius: var(--r-pill); text-decoration: none; color: var(--lib-teal-dark); font-size: .9rem; }
.period-pills a:hover { background: var(--lib-teal-pale); }
.period-pills a.active { background: var(--lib-teal); color: #fff; }

.chart-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 1rem 1.2rem; height: 100%; }
.chart-head { margin-bottom: .8rem; }
.chart-head h2 { color: var(--lib-teal-dark); }
.chart-sub { font-size: .82rem; color: #637477; margin-top: .15rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: #4a5a5c; margin-top: .4rem; }
.chart-legend i { display: inline-block; vertical-align: middle; margin-inline-end: .35rem; }
.sw-bar { width: 14px; height: 10px; border-radius: 3px; background: var(--chart-1); }
.sw-marker { width: 3px; height: 14px; border-radius: 2px; background: var(--chart-ref); }
.chart-empty { color: #7a8a8c; text-align: center; padding: 2rem 1rem; background: #f8fafa; border-radius: var(--r-md); font-size: .9rem; }
.chart-zero { margin-top: .6rem; font-size: .8rem; color: #6b7c7e; line-height: 1.7; }
.chart-zero b { color: #3e4f51; font-weight: 600; }
.chart-table { margin-top: .7rem; font-size: .85rem; }
.chart-table summary { cursor: pointer; color: var(--lib-teal); font-size: .82rem; }
.chart-table table { margin-top: .4rem; }

/* horizontal bars: name | track | value, growing from the right (RTL) */
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { position: relative; display: grid; grid-template-columns: minmax(110px, 34%) 1fr 64px; align-items: center; gap: .6rem;
        text-decoration: none; color: var(--lib-text); padding: 3px 4px; border-radius: 6px; }
.hbar:hover, .hbar:focus-visible { background: #f4f8f8; outline: none; }
.hbar-label { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { position: relative; height: 14px; background: var(--chart-track); border-radius: 4px; }
.hbar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--chart-1); border-radius: 4px; min-width: 3px; }
.hbar:hover .hbar-fill { background: var(--chart-1-hi); }
.hbar-marker { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-inline-start: -1px; background: var(--chart-ref);
               border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.hbar-value { font-size: .84rem; color: #3e4f51; text-align: end; font-variant-numeric: tabular-nums; }

/* month columns: oldest on the right */
.mcols { display: flex; gap: 6px; align-items: stretch; height: 190px; padding-top: 1.2rem; border-bottom: 1px solid var(--chart-grid); }
.mcol { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; outline: none; }
.mcol-plot { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.mcol-fill { position: relative; width: 70%; max-width: 34px; background: var(--chart-1); border-radius: 4px 4px 0 0; min-height: 3px; }
.mcol-fill.zero { background: transparent; }
.mcol:hover .mcol-fill, .mcol:focus-visible .mcol-fill { background: var(--chart-1-hi); }
.mcol-value { position: absolute; bottom: 100%; left: -10px; right: -10px; text-align: center; font-size: .75rem; color: #3e4f51; padding-bottom: 2px; }
.mcol-label { font-size: .68rem; line-height: 1.15; min-height: 2.6em; color: #7a8a8c; text-align: center; padding-top: .3rem; overflow-wrap: anywhere; }

/* tooltip shown on hover / keyboard focus */
.chart-tip { position: absolute; z-index: 5; bottom: calc(100% + 4px); inset-inline-start: 0; display: none; pointer-events: none;
             background: var(--lib-teal-deep); color: #fff; font-size: .8rem; padding: .35rem .6rem; border-radius: 8px;
             white-space: nowrap; box-shadow: var(--shadow); }
.hbar:hover .chart-tip, .hbar:focus-visible .chart-tip, .mcol:hover .chart-tip, .mcol:focus-visible .chart-tip { display: block; }
.mcol .chart-tip { inset-inline-start: 50%; transform: translateX(50%); }

/* الجداول على الهاتف: تتحرك أفقياً بالإصبع، وعناوين الأعمدة لا تنكسر */
.table-responsive, .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
    .table { font-size: .9rem; }
    .table > :not(caption) > * > * { padding: .6rem .65rem; }
    .table thead th { white-space: nowrap; }
    .table td .btn, .table td .badge { white-space: nowrap; }
}

/* Dewey suggestion on the book form */
.dewey-box { background: #f5fafa; border: 1px solid rgba(27,102,112,.15); border-radius: var(--r-md); padding: .9rem 1rem; }
.dewey-head { font-size: .9rem; color: #3e4f51; margin-bottom: .6rem; }
.dewey-list { display: grid; gap: .6rem; }
.dewey-item { display: flex; gap: .8rem; align-items: flex-start; background: #fff; border-radius: var(--r-md); padding: .6rem .8rem; border: 1px solid #e6eeee; }
.dewey-item.first { border-color: rgba(0,147,155,.45); }
.dewey-item .dewey-pick.btn { min-width: 5.5rem; font-weight: 600; }
.dewey-info { min-width: 0; flex: 1; }
.dewey-ex { margin-top: .25rem; overflow-wrap: anywhere; }
.dewey-conf { font-size: .78rem; border-radius: var(--r-pill); padding: .1rem .55rem; margin-inline-start: .3rem; }
.dewey-conf.high { background: #dff3ee; color: #1d6b57; }
.dewey-conf.mid  { background: #fbf1dc; color: #7a5a14; }
.dewey-conf.low  { background: #f3e7e4; color: #8a4a3c; }

/* Dewey browser */
.db-crumbs { font-size: .9rem; line-height: 1.9; }
.db-crumbs a { color: var(--lib-teal); text-decoration: none; }
.db-crumbs a:hover { text-decoration: underline; }
.db-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.db-item, .db-row { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: start; background: #fff;
    border: 1px solid #e3ecec; border-radius: var(--r-md); padding: .55rem .75rem; color: inherit; }
.db-item:hover:not(:disabled), .db-row:hover { border-color: rgba(0,147,155,.5); background: #f4fafa; }
.db-item.unused { opacity: .45; }
.db-row { border-radius: .5rem; padding-block: .4rem; margin-bottom: .3rem; }
.db-row.sel { border-color: var(--chart-1, #00939b); background: #e9f6f6; }
.db-num { unicode-bidi: isolate; font-weight: 700; color: var(--lib-teal); min-width: 3.6rem; font-variant-numeric: tabular-nums; }
.db-cap { flex: 1; min-width: 0; }
.db-count { font-size: .75rem; background: #eef4f4; color: #4d6062; border-radius: var(--r-pill); padding: .05rem .5rem; }
.db-scroll { max-height: 52vh; overflow-y: auto; padding-inline-end: .2rem; }
.db-tabs .nav-link { border-radius: var(--r-pill); }
.db-footer { justify-content: space-between; align-items: flex-start; gap: .6rem; }
.db-result { flex: 1; min-width: 0; }
.db-number { font-size: 1.35rem; color: var(--lib-teal); }

/* Library activities */
.dropdown-scroll { max-height: 70vh; overflow-y: auto; }
.activity-filter { min-width: 260px; }
.activity-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.activity-photos { display: grid; grid-template-columns: 1fr; gap: 2px; background: #eef3f3; }
.activity-photos.two { grid-template-columns: 1fr 1fr; }
.activity-photos img { width: 100%; height: 220px; object-fit: cover; display: block; }
.activity-photos.two img { height: 180px; }
.activity-meta { font-size: .82rem; color: #6b7c7e; margin-bottom: .3rem; }
.activity-meta a { color: var(--lib-teal); text-decoration: none; }
.activity-title { color: var(--lib-teal-dark); font-weight: 700; margin-bottom: .35rem; }
.activity-details { white-space: pre-line; font-size: .92rem; line-height: 1.8; }
.activity-thumb { width: 52px; height: 40px; object-fit: cover; border-radius: .35rem; border: 1px solid #dfe8e8; }
.activity-upload img { max-width: 100%; max-height: 180px; display: block; }

/* Magazine "بيت الرقيم" */
.mag-card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.mag-cover { display: block; aspect-ratio: 3 / 4; background: #eef3f3; overflow: hidden; }
.mag-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.mag-card:hover .mag-cover img { transform: scale(1.03); }
.mag-cover-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
    background: linear-gradient(160deg, var(--lib-teal), var(--lib-teal-dark)); color: #fff; }
.mag-cover-empty span { font-family: "PT Bold Heading Web", "Cairo", sans-serif; font-size: 1.6rem; }
.mag-cover-empty b { color: #e9d7a8; }
.mag-title { color: var(--lib-teal-dark); font-weight: 700; }
.mag-details { white-space: pre-line; line-height: 1.8; }
.mag-thumb { width: 44px; height: 58px; object-fit: cover; border-radius: .35rem; border: 1px solid #dfe8e8; }
.mag-edit-cover { max-width: 100%; max-height: 240px; display: block; }

/* "من نحن" */
.about-page { background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 1fr; }
.about-image img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.about-body { padding: 2rem clamp(1rem, 4vw, 3rem) 2.5rem; }
.about-body h1 { color: var(--lib-teal-dark); font-weight: 800; }
.about-text { white-space: pre-line; line-height: 2; font-size: 1.05rem; max-width: 70ch; }
