@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #090909;
    --surface: #101010;
    --surface-2: #151515;
    --surface-3: #1b1b1b;

    --border: rgba(255,255,255,.09);
    --text: #f4f4f4;
    --muted: #898989;
    --muted-2: #5e5e5e;

    --white: #ffffff;
    --danger: #ff5c5c;

    --radius: 18px;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 80% 10%, rgba(255,255,255,.045), transparent 30%),
        radial-gradient(circle at 10% 90%, rgba(255,255,255,.025), transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: "Inter", Arial, sans-serif;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    padding: 28px 18px;
    background: rgba(12,12,12,.94);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 8px 35px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #f1f1f1;
    color: #090909;
    font-weight: 700;
    box-shadow:
        0 8px 25px rgba(255,255,255,.08),
        inset 0 -3px 8px rgba(0,0,0,.15);
}

.brand h2 {
    font-size: 16px;
    letter-spacing: 2px;
}

.brand span {
    color: var(--muted);
    font-size: 10px;
}

.menu-title,
.small-label {
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

.menu-title {
    padding: 0 12px 10px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 0;
    background: transparent;
    color: #777;
    padding: 13px 12px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    margin-bottom: 5px;
    transition: .25s;
}

.nav-item span {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.045);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(
        145deg,
        rgba(255,255,255,.11),
        rgba(255,255,255,.035)
    );
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,.07),
        0 8px 25px rgba(0,0,0,.25);
}

.sidebar-bottom {
    margin-top: auto;
    padding: 15px 10px 5px;
    color: var(--muted-2);
    font-size: 10px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 15px;
    color: #aaa;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,.5);
}

/* =========================
   MAIN
========================= */

.main {
    margin-left: 250px;
    min-height: 100vh;
    padding: 0 42px 50px;
}

.header {
    min-height: 95px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 23px;
    margin-top: 5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.date-box {
    color: var(--muted);
    font-size: 12px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile strong {
    display: block;
    font-size: 12px;
}

.profile span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.avatar {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    background: #1d1d1d;
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 12px;
}

/* =========================
   SECTIONS
========================= */

.section {
    display: none;
    padding-top: 35px;
    animation: fadeUp .35s ease;
}

.section.active-section {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   WELCOME
========================= */

.welcome {
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px;
    margin-bottom: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(
            135deg,
            rgba(255,255,255,.065),
            rgba(255,255,255,.018)
        );
    box-shadow:
        0 20px 60px rgba(0,0,0,.2),
        inset 1px 1px 0 rgba(255,255,255,.04);
}

.welcome h2 {
    max-width: 600px;
    margin: 8px 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.15;
}

.welcome p:not(.small-label) {
    color: var(--muted);
    max-width: 650px;
    font-size: 13px;
    line-height: 1.7;
}

.welcome-icon {
    width: 90px;
    height: 90px;
    display: grid;
    place-items: center;
    border-radius: 28px;
    background: #eee;
    color: #111;
    font-size: 34px;
    font-weight: 700;
    box-shadow: 15px 20px 40px rgba(0,0,0,.3);
    transform: rotate(7deg);
}

/* =========================
   STATS
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 22px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 105px;
    padding: 20px;
    background: linear-gradient(145deg, #141414, #0d0d0d);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow:
        8px 10px 25px rgba(0,0,0,.25),
        inset 1px 1px 0 rgba(255,255,255,.025);
    transition: .3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,.15);
}

.stat-icon {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(255,255,255,.06);
    color: #ccc;
    font-size: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 7px;
}

.stat-card strong {
    font-size: 25px;
}

/* =========================
   GRID
========================= */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

.panel {
    background: rgba(16,16,16,.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow:
        0 18px 45px rgba(0,0,0,.16),
        inset 1px 1px 0 rgba(255,255,255,.02);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 21px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    margin-top: 6px;
    font-size: 15px;
}

.text-button {
    border: 0;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    font-size: 11px;
}

.text-button:hover {
    color: #fff;
}

/* =========================
   TABLE
========================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--muted-2);
    font-size: 10px;
    letter-spacing: .8px;
    font-weight: 600;
    padding: 15px 20px;
    white-space: nowrap;
}

td {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,.045);
    font-size: 12px;
    color: #cfcfcf;
    white-space: nowrap;
}

tr {
    transition: .2s;
}

tbody tr:hover {
    background: rgba(255,255,255,.025);
}

.book-name {
    color: #fff;
    font-weight: 600;
}

.book-author {
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 100px;
    background: rgba(255,255,255,.07);
    color: #aaa;
    font-size: 10px;
}

.badge.available {
    color: #ddd;
}

.badge.borrowed {
    color: #888;
    background: rgba(255,255,255,.04);
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: #151515;
    color: #aaa;
    border-radius: 8px;
    cursor: pointer;
    transition: .2s;
}

.icon-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,.2);
}

.icon-btn.delete:hover {
    color: var(--danger);
}

/* =========================
   POPULAR
========================= */

.popular-list {
    padding: 8px 20px 20px;
}

.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.popular-item:last-child {
    border-bottom: 0;
}

.book-number {
    color: #555;
    font-size: 11px;
    width: 20px;
}

.book-cover {
    width: 35px;
    height: 45px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg,#292929,#111);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 700;
    color: #aaa;
}

.popular-info {
    flex: 1;
}

.popular-info strong {
    display: block;
    font-size: 11px;
    margin-bottom: 5px;
}

.popular-info span {
    color: var(--muted);
    font-size: 9px;
}

/* =========================
   SECTION TOP
========================= */

.section-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.section-top h2 {
    font-size: 25px;
    margin: 7px 0;
}

.section-top p:not(.small-label) {
    color: var(--muted);
    font-size: 12px;
}

/* =========================
   BUTTON
========================= */

.primary-btn,
.secondary-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: .25s;
}

.primary-btn {
    background: #eee;
    color: #111;
    border: 1px solid #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
}

.primary-btn:hover {
    background: #fff;
    transform: translateY(-2px);
}

.secondary-btn {
    background: #151515;
    color: #aaa;
    border: 1px solid var(--border);
}

.secondary-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,.18);
}

/* =========================
   TOOLBAR
========================= */

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.search-box {
    flex: 1;
    max-width: 500px;
    height: 43px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: #111;
    border: 1px solid var(--border);
    border-radius: 11px;
}

.search-box span {
    color: #666;
    font-size: 20px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #fff;
    font-size: 12px;
}

select,
input {
    font-family: inherit;
}

.toolbar select {
    min-width: 180px;
    background: #111;
    color: #aaa;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0 13px;
    outline: none;
}

/* =========================
   FORM
========================= */

.form-panel {
    padding: 25px;
    margin-bottom: 22px;
    background: #101010;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    color: #aaa;
    font-size: 11px;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 43px;
    padding: 0 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0c0c0c;
    color: #eee;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: rgba(255,255,255,.25);
}

/* =========================
   MODAL
========================= */

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 500;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: min(650px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    background: #111;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 30px 100px rgba(0,0,0,.6);
    animation: modalIn .25s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    margin-top: 6px;
    font-size: 19px;
}

.close-modal {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #171717;
    color: #aaa;
    cursor: pointer;
    font-size: 20px;
}

.close-modal:hover {
    color: #fff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 5px;
}

/* =========================
   EMPTY
========================= */

.empty {
    padding: 45px 20px;
    text-align: center;
    color: #555;
    font-size: 12px;
}

/* =========================
   TOAST
========================= */

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    padding: 13px 18px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #171717;
    color: #ddd;
    font-size: 11px;
    box-shadow: 0 15px 40px rgba(0,0,0,.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: .3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   MOBILE
========================= */

.mobile-menu {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    background: #111;
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
}

@media (max-width: 1100px) {

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {

    .sidebar {
        transform: translateX(-100%);
        transition: .3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 0 20px 40px;
    }

    .mobile-menu {
        display: block;
        margin-right: 15px;
    }

    .header {
        gap: 10px;
    }

    .header > div:first-of-type {
        margin-right: auto;
    }

    .date-box {
        display: none;
    }

    .profile div:last-child {
        display: none;
    }

    .header {
        min-height: 80px;
    }

    .welcome {
        padding: 25px;
    }

    .welcome-icon {
        display: none;
    }

    .section-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-box {
        max-width: none;
    }

    .toolbar select {
        height: 43px;
    }
}

@media (max-width: 550px) {

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .welcome h2 {
        font-size: 23px;
    }

    .section {
        padding-top: 25px;
    }

    .main {
        padding-left: 14px;
        padding-right: 14px;
    }

    .stat-card {
        min-height: 90px;
    }

    .section-top h2 {
        font-size: 22px;
    }
}