:root {
    --library-primary: #5b4ce2;
    --library-primary-dark: #4637c7;
    --library-primary-soft: #eeecff;

    --library-bg: #f7f8fc;
    --library-surface: #ffffff;
    --library-border: #e9eaf0;

    --library-text: #171923;
    --library-muted: #737789;

    --library-success: #198754;
    --library-danger: #dc3545;

    --library-radius-sm: 10px;
    --library-radius-md: 14px;
    --library-radius-lg: 20px;

    --library-shadow-sm: 0 2px 10px rgba(20, 20, 40, .04);
    --library-shadow-md: 0 10px 30px rgba(20, 20, 40, .07);
}

/* =========================================================
   GLOBAL
========================================================= */

html {
    scroll-behavior: smooth;
}

body {
    background: var(--library-bg);
    color: var(--library-text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.6;
}

a {
    text-decoration: none;
}

.container {
    max-width: 1200px;
}

/* =========================================================
   NAVBAR
========================================================= */

.library-navbar {
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--library-border);
}

.library-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: var(--library-primary);
    font-weight: 800;
    letter-spacing: -.4px;
}

.library-logo-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
    margin-right: 8px;
}

.library-brand-icon {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: var(--library-primary-soft);
    color: var(--library-primary);

    font-size: 19px;
}

.library-navbar .nav-link {
    color: #5f6270;
    font-weight: 500;
    padding: 9px 13px;
    border-radius: 10px;
    transition: .18s ease;
}

.library-navbar .nav-link:hover {
    background: var(--library-primary-soft);
    color: var(--library-primary);
}

.library-user {
    color: var(--library-muted);
    font-size: .875rem;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
    border-radius: 11px;
    font-weight: 600;
    transition: all .18s ease;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: var(--library-primary-dark);
    border-color: var(--library-primary-dark);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--library-primary);
    border-color: #d8d4ff;
}

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

/* =========================================================
   CARDS
========================================================= */

.library-card {
    background: var(--library-surface);
    border: 1px solid var(--library-border);
    border-radius: var(--library-radius-lg);
    box-shadow: var(--library-shadow-sm);
}

.library-card-hover {
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        border-color .2s ease;
}

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

/* =========================================================
   ADMIN
========================================================= */

.admin-shell {
    min-height: calc(100vh - 70px);
}

.admin-sidebar {
    position: sticky;
    top: 90px;
}

.admin-sidebar-card {
    background: var(--library-surface);
    border: 1px solid var(--library-border);
    border-radius: var(--library-radius-lg);
    box-shadow: var(--library-shadow-sm);
    padding: 10px;
}

.admin-sidebar-title {
    padding: 14px 14px 10px;
    color: var(--library-muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.admin-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 11px;

    padding: 11px 13px;

    border-radius: 11px;

    color: #626575;
    font-weight: 600;

    transition: .18s ease;
}

.admin-menu-item:hover {
    background: var(--library-primary-soft);
    color: var(--library-primary);
}

.admin-menu-item.active {
    background: var(--library-primary);
    color: #fff;
    box-shadow: 0 5px 14px rgba(91, 76, 226, .22);
}

.admin-menu-icon {
    width: 23px;
    text-align: center;
}

/* =========================================================
   PAGE HEADER
========================================================= */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -.5px;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--library-muted);
    font-size: .9rem;
}

/* =========================================================
   STAT CARDS
========================================================= */

.stat-card-modern {
    position: relative;
    overflow: hidden;

    background: var(--library-surface);
    border: 1px solid var(--library-border);
    border-radius: var(--library-radius-lg);

    padding: 20px;

    box-shadow: var(--library-shadow-sm);

    transition: .2s ease;
}

.stat-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--library-shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    background: var(--library-primary-soft);
    color: var(--library-primary);

    font-size: 20px;
}

.stat-label {
    margin-top: 16px;

    color: var(--library-muted);
    font-size: .82rem;
    font-weight: 600;
}

.stat-value {
    margin-top: 2px;

    font-size: 1.85rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.7px;
}

/* =========================================================
   TABLE
========================================================= */

.library-table {
    margin-bottom: 0;
}

.library-table thead th {
    border-bottom: 1px solid var(--library-border);
    color: var(--library-muted);

    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.library-table tbody td {
    padding-top: 15px;
    padding-bottom: 15px;
    border-color: #f0f0f4;
    vertical-align: middle;
}

.library-table tbody tr {
    transition: background .15s ease;
}

.library-table tbody tr:hover {
    background: #fafaff;
}

/* =========================================================
   BADGES
========================================================= */

.badge {
    border-radius: 8px;
    padding: 6px 9px;
    font-weight: 600;
}

/* =========================================================
   FORM
========================================================= */

.form-control,
.form-select {
    border-color: var(--library-border);
    border-radius: 11px;
    padding: 10px 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: #b9b3ff;
    box-shadow: 0 0 0 .2rem rgba(91, 76, 226, .10);
}

/* =========================================================
   ALERT
========================================================= */

.alert {
    border: 0;
    border-radius: 14px;
}

/* =========================================================
   FOOTER
========================================================= */

.library-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: #f8f9fa;
}

.library-footer-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    display: block;
    margin-right: 12px;
}

.library-footer-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #212529;
}

.library-footer-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 2px;
}

.library-footer-copy {
    font-size: 0.85rem;
    color: #495057;
}

.library-footer-small {
    font-size: 0.75rem;
    color: #868e96;
    margin-top: 4px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 991.98px) {

    .admin-sidebar {
        position: static;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {

    .page-title {
        font-size: 1.3rem;
    }

    .stat-value {
        font-size: 1.55rem;
    }

    .library-navbar .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* =====================================================
   BRANDING
===================================================== */

.library-logo {
    height: 12px;
    width: auto;
    max-width: 180px;
    padding: 10px;
    object-fit: contain;
    display: block;
    margin-right: 10px;
}

.library-brand {
    text-decoration: none;
}

/* =========================================================
   MOBILE RESPONSIVE
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 767.98px) {

    .library-hero {
        padding: 38px 16px 42px;
        overflow: hidden;
    }

    .library-hero .container {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .hero-badge {
        font-size: .72rem;
        padding: 6px 10px;
        margin-bottom: 16px;
    }

    .hero-title {
        font-size: clamp(2.35rem, 10vw, 3.25rem);
        line-height: 1.02;
        letter-spacing: -1.8px;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .hero-description {
        font-size: .98rem;
        line-height: 1.65;
        margin-bottom: 24px;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .hero-actions .btn {
        width: 100%;
        min-height: 48px;
        padding: 10px 12px;
        font-size: .86rem;
    }

    .search-panel {
        margin-top: 30px;
        padding: 18px;
        border-radius: 18px;
        max-width: 100%;
        overflow: hidden;
    }

    .search-panel .form-control,
    .search-panel .form-select,
    .search-btn {
        min-height: 48px;
        font-size: .9rem;
        max-width: 100%;
    }

    .catalog-section {
        padding: 42px 16px 55px;
    }

    .catalog-section .container {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .section-title {
        font-size: 1.45rem;
    }

    .book-card {
        border-radius: 15px !important;
    }

    .book-card .card-body {
        padding: 13px !important;
    }

    .book-title {
        font-size: .88rem;
    }

    .book-author {
        font-size: .76rem;
        margin-bottom: 14px;
    }

    .book-btn {
        font-size: .75rem;
        padding: 8px 9px;
    }

    .book-category {
        font-size: .66rem;
        padding: 4px 7px;
    }
}

@media (max-width: 420px) {

    .library-hero {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-title {
        font-size: 2.35rem;
    }

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

    .hero-actions .btn {
        width: 100%;
    }

    .search-panel {
        padding: 15px;
    }

    .search-panel .row > div {
        width: 100%;
    }

    .search-btn {
        margin-top: 2px;
    }

    .catalog-section {
        padding-left: 14px;
        padding-right: 14px;
    }
}
