* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #070708;
    --panel: #101012;
    --panel-2: #151518;
    --border: rgba(255,255,255,.08);
    --text: #f4f4f5;
    --muted: #8f8f98;
    --red: #e32645;
    --red-dark: #a9142d;
    --green: #2fd47c;
    --yellow: #f1bd4b;
    --ease: cubic-bezier(.2,.8,.2,1);
}

html,
body {
    width: 100%;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* INTRO */

.intro-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(227, 38, 69, .16), transparent 28%),
        #050507;
    transition: opacity .8s var(--ease),
                transform .8s var(--ease),
                filter .8s var(--ease);
}

.intro-screen.intro-hide {
    opacity: 0;
    transform: scale(1.08);
    filter: blur(18px);
    pointer-events: none;
}

.intro-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.intro-small {
    color: #77777f;
    letter-spacing: 7px;
    font-size: 11px;
    margin-bottom: 15px;
}

.intro-mark {
    font-size: clamp(70px, 15vw, 150px);
    font-weight: 900;
    letter-spacing: 18px;
    color: white;
    text-shadow:
        0 0 20px rgba(227,38,69,.3),
        0 0 70px rgba(227,38,69,.15);
}

.intro-line {
    height: 2px;
    width: 0;
    margin: 12px auto 16px;
    background: var(--red);
    animation: introLine 1.2s 1s forwards;
}

@keyframes introLine {
    to {
        width: 170px;
    }
}

.intro-subtitle {
    color: #aaaab2;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-size: 12px;
}

.intro-progress {
    width: 180px;
    height: 2px;
    margin: 40px auto 0;
    background: rgba(255,255,255,.08);
    overflow: hidden;
}

.intro-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--red);
    animation: progress 2.5s ease forwards;
}

@keyframes progress {
    to {
        width: 100%;
    }
}

.intro-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(227,38,69,.08);
    filter: blur(80px);
}

/* LOGIN */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background:
        radial-gradient(circle at top, rgba(227,38,69,.1), transparent 35%),
        var(--bg);
}

.login-box {
    width: 100%;
    max-width: 430px;
    padding: 38px;
    border: 1px solid var(--border);
    background: rgba(15,15,17,.94);
    border-radius: 18px;
    box-shadow: 0 30px 100px rgba(0,0,0,.5);
}

.login-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 15px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--red);
    box-shadow: 0 10px 35px rgba(227,38,69,.25);
}

.login-logo span {
    font-size: 28px;
    font-weight: 900;
}

.login-brand {
    text-align: center;
    font-size: 27px;
    font-weight: 900;
    letter-spacing: 4px;
}

.login-school {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 2px;
    margin-top: 7px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    background: #08080a;
    border-radius: 10px;
    padding: 5px;
    margin: 30px 0 25px;
}

.auth-tab {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    padding: 11px;
}

.auth-tab.active {
    background: var(--red);
    color: white;
}

.auth-title {
    font-weight: 700;
    margin-bottom: 18px;
}

.login-box label,
.modal-box label {
    display: block;
    color: #b5b5bd;
    font-size: 12px;
    margin: 15px 0 7px;
}

.login-box input,
.modal-box input,
.modal-box select,
.toolbar input {
    width: 100%;
    background: #08080a;
    border: 1px solid var(--border);
    color: white;
    border-radius: 9px;
    padding: 13px 14px;
    outline: none;
}

.login-box input:focus,
.modal-box input:focus,
.modal-box select:focus,
.toolbar input:focus {
    border-color: rgba(227,38,69,.7);
    box-shadow: 0 0 0 3px rgba(227,38,69,.08);
}

.main-button {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 13px 18px;
    margin-top: 20px;
    background: var(--red);
    color: white;
    font-weight: 700;
    transition: .2s ease;
}

.main-button:hover {
    background: #f02c4c;
    transform: translateY(-1px);
}

.main-button.small {
    width: auto;
    margin-top: 0;
    padding: 11px 18px;
}

.form-message {
    min-height: 20px;
    text-align: center;
    color: #ff697f;
    font-size: 12px;
    margin-top: 12px;
}

/* APP */

.app {
    min-height: 100vh;
    display: flex;
}

/* SIDEBAR */

.sidebar {
    width: 255px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 25px 16px;
    background: #0b0b0d;
    border-right: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 8px 22px;
}

.sidebar-logo-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 21px;
}

.sidebar-logo strong {
    display: block;
    letter-spacing: 3px;
}

.sidebar-logo small {
    color: #707078;
    font-size: 8px;
    letter-spacing: 2px;
}

.sidebar-school {
    font-size: 9px;
    color: #66666e;
    padding: 0 9px 22px;
    letter-spacing: 1px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #85858d;
    padding: 13px 14px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    transition: .2s;
}

.nav-item span {
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255,255,255,.04);
    color: white;
}

.nav-item.active {
    background: rgba(227,38,69,.13);
    color: white;
    border-left: 3px solid var(--red);
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 13px;
    border-top: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.sidebar-user strong,
.sidebar-user small {
    display: block;
}

.sidebar-user strong {
    font-size: 12px;
}

.sidebar-user small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.logout-button {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: #9999a1;
    border-radius: 8px;
    padding: 10px;
}

.logout-button:hover {
    color: white;
    border-color: rgba(227,38,69,.5);
}

/* MAIN */

.main {
    margin-left: 255px;
    width: calc(100% - 255px);
    min-height: 100vh;
    padding: 0 34px 50px;
}

.topbar {
    height: 88px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.topbar-label {
    font-size: 9px;
    color: var(--red);
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.topbar h1 {
    font-size: 21px;
}

.topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

/* PAGES */

.page {
    display: none;
}

.page.active {
    display: block;
}

.welcome-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    background:
        radial-gradient(circle at right, rgba(227,38,69,.1), transparent 35%),
        var(--panel);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.red-label,
.panel-label {
    color: var(--red);
    font-size: 9px;
    letter-spacing: 3px;
    font-weight: 700;
}

.welcome-box h2 {
    margin: 8px 0;
    font-size: 28px;
}

.welcome-box p {
    color: var(--muted);
    max-width: 650px;
    line-height: 1.6;
}

.welcome-icon {
    font-size: 55px;
    opacity: .9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.stat-card {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 13px;
    padding: 21px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 43px;
    height: 43px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(227,38,69,.1);
    font-size: 20px;
}

.stat-card small {
    display: block;
    color: #777780;
    font-size: 8px;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.stat-card strong {
    font-size: 25px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.panel {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 14px;
    overflow: hidden;
}

.panel-header {
    padding: 20px 21px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    margin-top: 6px;
    font-size: 16px;
}

.reading-list,
.ranking-list {
    padding: 10px;
}

.reading-item,
.rank-item {
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.reading-item:last-child,
.rank-item:last-child {
    border-bottom: 0;
}

.reading-main {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.reading-book {
    font-weight: 700;
}

.reading-student {
    color: var(--red);
    font-size: 12px;
    margin-top: 5px;
}

.reading-date {
    color: #777780;
    font-size: 10px;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 13px;
}

.rank-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(227,38,69,.1);
    border-radius: 8px;
    color: var(--red);
    font-weight: 800;
}

.rank-info {
    flex: 1;
}

.rank-info strong {
    display: block;
    font-size: 13px;
}

.rank-info small {
    color: var(--muted);
    font-size: 10px;
}

.rank-count {
    font-weight: 800;
}

.empty-state {
    color: #676770;
    text-align: center;
    padding: 30px 15px;
    font-size: 12px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.quick-card {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 13px;
    padding: 20px;
    text-align: left;
    color: white;
    transition: .2s;
}

.quick-card:hover {
    border-color: rgba(227,38,69,.45);
    transform: translateY(-2px);
}

.quick-card > span {
    display: block;
    font-size: 23px;
    color: var(--red);
    margin-bottom: 15px;
}

.quick-card strong,
.quick-card small {
    display: block;
}

.quick-card small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 5px;
}

/* PAGE HEADINGS */

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 20px;
}

.page-heading h2 {
    font-size: 28px;
    margin: 7px 0;
}

.page-heading p {
    color: var(--muted);
    font-size: 13px;
}

.toolbar {
    margin-bottom: 14px;
    max-width: 420px;
}

/* TABLE */

.table-panel {
    padding: 0;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th {
    color: #696970;
    text-align: left;
    font-size: 9px;
    letter-spacing: 1px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

td {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.045);
    font-size: 12px;
    color: #d5d5da;
}

tr:last-child td {
    border-bottom: 0;
}

.book-title {
    color: white;
    font-weight: 700;
}

.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
}

.badge.available {
    color: var(--green);
    background: rgba(47,212,124,.1);
}

.badge.borrowed {
    color: var(--red);
    background: rgba(227,38,69,.1);
}

.badge.warning {
    color: var(--yellow);
    background: rgba(241,189,75,.1);
}

.table-button {
    border: 1px solid var(--border);
    background: transparent;
    color: #bbb;
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 10px;
}

.table-button:hover {
    border-color: var(--red);
    color: white;
}

.table-button.return {
    border-color: rgba(47,212,124,.25);
    color: var(--green);
}

/* MODALS */

.modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(7px);
}

.modal-box {
    width: 100%;
    max-width: 450px;
    background: #111114;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    position: relative;
    box-shadow: 0 30px 100px rgba(0,0,0,.7);
}

.modal-box h2 {
    margin-top: 8px;
}

.modal-description {
    color: var(--muted);
    font-size: 12px;
    margin-top: 7px;
    line-height: 1.5;
}

.modal-close {
    position: absolute;
    right: 18px;
    top: 18px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,.05);
    color: #aaa;
    font-size: 20px;
}

.modal-close:hover {
    background: var(--red);
    color: white;
}

#toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 999999;
    max-width: 350px;
    padding: 13px 17px;
    border-radius: 9px;
    background: #18181b;
    border: 1px solid var(--border);
    color: white;
    font-size: 12px;
    box-shadow: 0 15px 50px rgba(0,0,0,.5);
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
    transition: .25s;
}

#toast.show {
    opacity: 1;
    transform: translateY(0);
}

#toast.success {
    border-color: rgba(47,212,124,.4);
}

#toast.error {
    border-color: rgba(227,38,69,.5);
}

/* MOBILE */

@media (max-width: 1000px) {

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 750px) {

    .sidebar {
        width: 70px;
        padding: 15px 9px;
    }

    .sidebar-logo {
        justify-content: center;
    }

    .sidebar-logo > div:last-child,
    .sidebar-school,
    .nav-item:not(.active)::after,
    .sidebar-user > div:last-child,
    .logout-button {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 13px 5px;
    }

    .main {
        margin-left: 70px;
        width: calc(100% - 70px);
        padding: 0 15px 35px;
    }

    .topbar {
        height: 75px;
    }

    .welcome-box {
        padding: 22px;
    }

    .welcome-box h2 {
        font-size: 22px;
    }

    .welcome-icon {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .page-heading {
        align-items: start;
        gap: 15px;
    }

}

@media (max-width: 500px) {

    .login-box {
        padding: 25px 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-heading {
        flex-direction: column;
    }

    .main-button.small {
        width: 100%;
    }

}