/* ==========================================================================
   Rajasi's Library — shared public theme
   Mirrors the look established on index.php so book-detail, cart and
   checkout share one visual language.
   ========================================================================== */
:root {
    --bg: #16110c;
    --surface: #211a12;
    --surface-2: #2a2115;
    --wood: #3a2a1a;
    --wood-dark: #241a10;
    --gold: #c89b3c;
    --gold-bright: #e0b955;
    --burgundy: #8b2e3c;
    --cream: #efe6d0;
    --cream-dim: #d9cdae;
    --muted: #9c8f76;
    --green: #63866c;
    --line: rgba(200, 155, 60, 0.22);
    --font-display: "Fraunces", "Noto Serif", serif;
    --font-body: "Noto Serif", Georgia, serif;
    --font-mono: "IBM Plex Mono", monospace;

    --primary-color: var(--wood);
    --secondary-color: var(--gold);
    --accent-color: var(--burgundy);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--cream);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(200, 155, 60, 0.07), transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(139, 46, 60, 0.10), transparent 50%);
    pointer-events: none;
    z-index: 0;
}
h1, h2, h3, h4 { font-family: var(--font-display); }
a { color: var(--gold); }
a:hover { color: var(--gold-bright); }

/* ---------- Navbar ---------- */
.navbar {
    background: rgba(22, 17, 12, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
}
.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--cream) !important;
}
.navbar-brand i { color: var(--gold); }
.navbar-text { color: var(--cream-dim) !important; }
.navbar-toggler {
    border: 1px solid var(--gold);
    padding: 6px 10px;
}
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(200, 155, 60, .25); }
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23c89b3c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--surface-2);
        border: 1px solid var(--line);
        border-radius: 6px;
        padding: 10px 12px;
        margin-top: 10px;
    }
}
.search-bar { max-width: 500px; }
.search-bar .form-control {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--cream);
}
.search-bar .form-control::placeholder { color: var(--muted); }
.search-bar .btn-light, .navbar .btn-light {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--cream);
}
.navbar .btn-light:hover { background: var(--gold); color: var(--wood-dark); }
.navbar .btn-warning {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--wood-dark);
    font-weight: 600;
}
.navbar .btn-warning:hover { background: var(--gold-bright); }
.navbar .dropdown-menu {
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.navbar .dropdown-item { color: var(--cream-dim); }
.navbar .dropdown-item:hover { background: var(--wood); color: var(--cream); }
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--burgundy);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* ---------- Surfaces ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--cream);
}
.card-title, .card-header { color: var(--cream); }
.card-title a { color: inherit; }
.card-title a:hover { color: var(--cream-dim); }
.card-header { background: var(--surface-2); border-color: var(--line); }
.text-muted { color: var(--muted) !important; }
.bg-light { background: var(--surface-2) !important; color: var(--cream) !important; }
.list-group-item {
    background: var(--surface);
    border-color: var(--line);
    color: var(--cream);
}
hr { border-color: var(--line); }

/* ---------- Buttons ---------- */
.btn-outline-primary { color: var(--gold); border-color: var(--gold); }
.btn-outline-primary:hover, .btn-primary {
    background-color: var(--gold);
    border-color: var(--gold);
    color: var(--wood-dark);
}
.btn-outline-primary:hover { color: var(--wood-dark); }
.btn-primary:hover { background-color: var(--gold-bright); border-color: var(--gold-bright); color: var(--wood-dark); }
.btn-secondary { background: var(--surface-2); border-color: var(--line); color: var(--cream-dim); }
.btn-secondary:hover { background: var(--wood); color: var(--cream); }
.btn-outline-danger { color: #e08a95; border-color: var(--burgundy); }
.btn-outline-danger:hover { background: var(--burgundy); color: #fff; }
.btn-add-cart {
    background-color: var(--gold);
    border: none;
    color: var(--wood-dark);
    font-weight: 600;
}
.btn-add-cart:hover { background-color: var(--gold-bright); color: var(--wood-dark); }
.btn-gold {
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--gold);
    color: var(--wood-dark) !important;
    border: 1px solid var(--gold);
    border-radius: 3px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.btn-gold:hover { background: var(--gold-bright); color: var(--wood-dark); }

/* ---------- Badges ---------- */
.badge-available { background-color: #3f6b47; }
.badge-limited { background-color: #a97c1f; }
.badge-unavailable { background-color: var(--burgundy); }

/* ---------- Section headings ---------- */
.section-title {
    border-left: 4px solid var(--gold);
    padding-left: 15px;
    margin-bottom: 25px;
    font-weight: 600;
    color: var(--cream);
}
.section-head { margin-bottom: 32px; max-width: 640px; }
.eyebrow {
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
    font-size: 13px;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--gold); display: inline-block; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--cream);
}
.form-control:focus, .form-select:focus {
    background: var(--surface-2);
    color: var(--cream);
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(200, 155, 60, 0.15);
}
.form-control::placeholder { color: var(--muted); }
.form-label { color: var(--cream-dim); }

/* ---------- Modals ---------- */
.modal-content {
    background: var(--surface-2);
    color: var(--cream);
    border: 1px solid var(--line);
}
.modal-header, .modal-footer { border-color: var(--line); }

/* ---------- Alerts ---------- */
.alert-info {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--cream-dim);
}

/* ---------- Footer ---------- */
footer.bg-dark {
    background: var(--wood-dark) !important;
    border-top: 1px solid var(--line);
    color: var(--cream-dim) !important;
}

/* ==========================================================================
   Book stack (shared: hero + shelves + similar)
   ========================================================================== */
.stack-stage {
    position: relative;
    height: 400px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 26px;
    padding-left: clamp(16px, 5vw, 70px);
    perspective: 1500px;
}
.stack-stage::before {
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: 6px;
    height: 14px;
    background: linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.55);
    border-top: 1px solid rgba(200, 155, 60, 0.25);
}
.book {
    position: relative;
    width: 160px;
    height: 250px;
    margin-left: -124px;
    transform-style: preserve-3d;
    transform-origin: left center;
    transform: rotateY(15deg);
    cursor: pointer;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1), z-index 0s;
    flex-shrink: 0;
    text-decoration: none;
}
.book:first-child { margin-left: 0; }
.book .cover {
    position: absolute;
    inset: 0;
    border-radius: 2px 5px 5px 2px;
    overflow: hidden;
    box-shadow: -10px 12px 22px rgba(0, 0, 0, 0.55), inset 3px 0 6px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.4);
    background: var(--wood-dark);
    display: block;
}
.book .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left center;
    display: block;
}
.book .cover.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--muted);
}
.book .cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.15) 18%, transparent 34%);
}
.book:hover, .book:focus-visible {
    transform: rotateY(0deg) translateY(-46px) translateZ(30px) scale(1.06);
    z-index: 20;
}
.book:hover .cover, .book:focus-visible .cover {
    box-shadow: 0 32px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(200, 155, 60, 0.4);
}
.book .card {
    position: absolute;
    bottom: calc(100% + 16px);
    left: 50%;
    transform: translate(-50%, 10px);
    width: 220px;
    background: var(--cream);
    color: #2a2016;
    padding: 14px 14px 12px;
    border: 1px solid #c9bd9d;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
    font-family: var(--font-mono);
}
.book:hover .card, .book:focus-visible .card {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}
.book .card .call-no { font-size: 10.5px; letter-spacing: .06em; color: #7a6a45; margin-bottom: 6px; }
.book .card h4 { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0 0 4px; line-height: 1.3; color: #241a10; }
.book .card .author { font-style: italic; font-size: 12px; color: #5c5138; margin-bottom: 8px; font-family: var(--font-body); }
.book .card .meta { display: flex; justify-content: space-between; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; border-top: 1px dashed #b9ab84; padding-top: 8px; margin-bottom: 10px; }
.book .card .status.avail { color: #3f6b47; }
.book .card .status.out { color: #8b2e3c; }
.book .card .card-actions { display: flex; gap: 6px; }
.book .card .card-actions .btn {
    font-family: var(--font-mono);
    font-size: 10.5px;
    padding: 6px 8px;
    border: 1px solid #7a6a45;
    color: #2a2016;
    background: transparent;
    cursor: pointer;
    flex: 1;
    text-align: center;
    text-decoration: none;
}
.book .card .card-actions .btn:hover { background: #2a2016; color: var(--cream); }

.stack-stage.compact {
    height: 236px;
    justify-content: flex-start;
    padding-bottom: 20px;
    padding-left: clamp(14px, 4vw, 40px);
}
.stack-stage.compact .book {
    width: 104px;
    height: 164px;
    margin-left: -76px;
}
.stack-stage.compact .book:hover, .stack-stage.compact .book:focus-visible {
    transform: rotateY(0deg) translateY(-28px) translateZ(20px) scale(1.1);
}
.stack-stage.compact .card { width: 195px; }

.room {
    background: linear-gradient(180deg, var(--surface) 0%, var(--wood-dark) 100%);
    border: 1px solid var(--line);
    padding: 36px clamp(16px, 4vw, 40px) 20px;
    border-radius: 4px;
    margin-bottom: 12px;
}
.shelf-row { margin-bottom: 44px; }
.shelf-row:last-child { margin-bottom: 0; }
.shelf-label {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--gold);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.shelf-label .muted-count { color: var(--muted); }
