@font-face {
    font-family: "Vazir";
    src: url("../../vazir/16.1.0/Vazir.woff2") format("woff2"),
         url("../../vazir/16.1.0/Vazir.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #17212b;
    --muted: #667085;
    --line: #d9e2ec;
    --paper: #ffffff;
    --wash: #f5f7fb;
    --brand: #1f7a68;
    --brand-strong: #155a4c;
    --accent: #d98c2b;
    --info: #315f9b;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(23, 33, 43, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--wash);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    overflow-x: hidden;
}

html[lang="fa"] body {
    font-family: "Vazir", Tahoma, sans-serif;
}

a {
    color: var(--brand-strong);
    text-decoration: none;
}

a:hover {
    color: var(--brand);
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(23, 33, 43, .04);
}

.header-bar {
    min-height: 74px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: center;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.brand-copy {
    display: grid;
    line-height: 1.1;
}

.brand-copy small {
    color: var(--muted);
    font-size: .75rem;
    margin-top: 4px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--brand);
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(31, 122, 104, .22);
}

.primary-nav {
    justify-self: center;
    display: flex;
    gap: 4px;
    align-items: center;
    background: #f1f5f7;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px;
}

.primary-nav a {
    color: var(--ink);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.primary-nav a:hover {
    color: var(--brand);
    background: #fff;
    transform: translateY(-1px);
}

.header-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    gap: 8px;
    align-items: center;
}

.main-area {
    flex: 1;
}

.page-band {
    padding: 48px 0 30px;
    background:
        linear-gradient(135deg, rgba(31, 122, 104, .13), rgba(49, 95, 155, .11)),
        #f6faf8;
    border-bottom: 1px solid var(--line);
}

.page-band-animated h1,
.page-band h1,
.page-band p {
    animation: riseIn .45s ease both;
}

.page-band p {
    animation-delay: .08s;
}

.page-band h1 {
    font-size: clamp(1.8rem, 2.4vw, 2.6rem);
    line-height: 1.15;
    margin: 0;
}

.page-band p {
    max-width: 760px;
    margin: 10px 0 0;
    color: var(--muted);
}

.content-section {
    padding: 28px 0;
}

.metric-grid,
.book-grid,
.management-grid {
    display: grid;
    gap: 16px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.book-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.management-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.panel,
.book-card,
.metric,
.table-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 2px 0 rgba(23, 33, 43, .02);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.panel,
.table-panel {
    padding: 20px;
}

.metric {
    padding: 18px;
}

.panel:hover,
.book-card:hover,
.metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #c2d4df;
}

.metric-alert {
    border-color: #f2c0ba;
    background: #fff7f5;
}

.metric-alert strong {
    color: var(--danger);
}

.metric strong {
    display: block;
    font-size: 1.8rem;
}

.metric span {
    color: var(--muted);
}

.book-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    animation: riseIn .42s ease both;
}

.book-cover {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #e7edf2;
    transition: transform .35s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.025);
}

.book-card-body {
    padding: 14px;
    display: grid;
    gap: 8px;
}

.book-card h2,
.book-card h3 {
    font-size: 1.05rem;
    line-height: 1.35;
    margin: 0;
}

.muted {
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4f1;
    color: var(--brand-strong);
    font-weight: 700;
    font-size: .85rem;
}

.status-pill.reading {
    background: #fff5e8;
    color: #8a4f00;
}

.status-pill.unavailable {
    background: #f1f2f4;
    color: #667085;
}

.status-pill.open,
.status-pill.contacted {
    background: #fff5e8;
    color: #8a4f00;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(23, 33, 43, .08);
}

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

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

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

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

.form-control,
.form-select {
    border-color: var(--line);
    border-radius: 8px;
    min-height: 42px;
}

.form-label {
    font-weight: 700;
}

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    padding: 24px 0;
}

.message-stack {
    animation: riseIn .28s ease both;
}

.table {
    vertical-align: middle;
}

.comment {
    border-top: 1px solid var(--line);
    padding: 14px 0;
}

.comment:first-child {
    border-top: 0;
}

.book-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    gap: 24px;
    align-items: start;
}

.detail-cover {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    background: #e7edf2;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.language-form select {
    min-width: 112px;
}

.loan-grid,
.issue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
}

.loan-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    min-height: 100%;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.loan-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: #c2d4df;
}

.loan-cover-wrap {
    position: relative;
    height: 190px;
    overflow: hidden;
    background: #e7edf2;
}

.loan-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.loan-card:hover .loan-cover {
    transform: scale(1.04);
}

.loan-status {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: rgba(255, 255, 255, .92);
}

.loan-card-body {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.loan-card h2 {
    font-size: 1.12rem;
    line-height: 1.35;
    margin: 0;
}

.transfer-code-box {
    border: 1px dashed rgba(31, 122, 104, .45);
    background: #f3fbf8;
    border-radius: 8px;
    padding: 12px;
    display: grid;
    gap: 2px;
}

.transfer-code-box span {
    color: var(--muted);
    font-size: .82rem;
}

.transfer-code-box strong {
    font-size: 2rem;
    letter-spacing: .08em;
    color: var(--brand-strong);
    font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

.quiet-note,
.issue-note {
    padding: 12px;
    border-radius: 8px;
    background: #f5f7fb;
    color: var(--muted);
}

.issue-note {
    background: #fff7f5;
    color: var(--danger);
}

.loan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.issue-disclosure {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.issue-disclosure summary {
    cursor: pointer;
    color: var(--danger);
    font-weight: 700;
}

.receive-panel {
    animation: riseIn .35s ease both;
}

.code-input {
    font-weight: 700;
    letter-spacing: .08em;
    font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

.reveal {
    animation: riseIn .45s ease both;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .header-bar {
        grid-template-columns: 1fr auto;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .primary-nav {
        grid-column: 1 / -1;
        justify-self: stretch;
        display: none;
        flex-direction: column;
        align-items: stretch;
        border-radius: 8px;
        background: #fff;
    }

    .primary-nav.is-open {
        display: flex;
        animation: riseIn .22s ease both;
    }

    .primary-nav a {
        border-radius: 8px;
    }

    .header-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .book-detail-layout {
        grid-template-columns: 1fr;
    }

    .page-band {
        padding-top: 28px;
    }
}
