
/* =========================================
   1. RESET DAN PENGATURAN DASAR
========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #315c52;
    --secondary: #52796b;
    --light-green: #eaf2ed;
    --background: #f4f7f6;
    --white: #ffffff;
    --text: #263c32;
    --muted: #84918a;
    --border: #e7eeea;
    --shadow: 0 5px 20px rgba(39, 76, 62, 0.06);
}

body {
    font-family: Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}


/* =========================================
   2. HALAMAN LOGIN
========================================= */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    background: transparent;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Background gambar */

.login-body::before {
    content: "";
    position: fixed;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    background:
        linear-gradient(
            rgba(235, 244, 237, 0.25),
            rgba(235, 244, 237, 0.25)
        ),
        url("images/perpustakaan.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(5px);
    z-index: 0;
    pointer-events: none;
}

/* Kotak login */

.login-box {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.96);
    width: 100%;
    max-width: 400px;
    padding: 35px;
    border-radius: 18px;
    box-shadow: 0 10px 35px #00000010;
}

/* Kotak lupa password */

.forgot-box {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.97);
    width: 100%;
    max-width: 420px;
    padding: 35px;
    border-radius: 18px;
    box-shadow: 0 10px 35px #00000010;
}

.login-box h1,
.login-box h2,
.forgot-box h1,
.forgot-box h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 10px;
}

.login-box p,
.forgot-box p {
    text-align: center;
    color: var(--muted);
    margin-bottom: 20px;
}

.login-box label,
.forgot-box label {
    display: block;
    margin: 15px 0 7px;
    font-weight: bold;
}

.login-box input,
.login-box select,
.forgot-box input,
.forgot-box select {
    width: 100%;
    padding: 12px;
    border: 1px solid #dce5df;
    border-radius: 8px;
    outline: none;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.login-box input:focus,
.login-box select:focus,
.forgot-box input:focus,
.forgot-box select:focus {
    border-color: var(--secondary);
}

.login-box button,
.forgot-box button {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 22px;
    cursor: pointer;
    transition: 0.3s;
}

.login-box button:hover,
.forgot-box button:hover {
    background: #24483f;
}

.login-box a,
.forgot-box a {
    color: var(--primary);
    font-weight: bold;
    text-decoration: none;
}

.alert {
    padding: 12px;
    background: #fff0ed;
    color: #a33b35;
    border-radius: 8px;
    margin-bottom: 15px;
}


/* =========================================
   3. LAYOUT DASHBOARD
========================================= */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: calc(100% - 250px);
    margin-left: 250px;
    padding: 35px 40px;
    animation: fadeIn 0.6s ease;
}


/* =========================================
   4. SIDEBAR
========================================= */

.sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 25px 18px;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    text-align: center;
    margin-bottom: 35px;
    padding: 8px 0;
}

.sidebar-brand h2,
.sidebar-logo {
    font-size: 23px;
    color: white;
    margin-bottom: 7px;
    font-weight: bold;
}

.sidebar-brand span,
.sidebar-subtitle {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: bold;
    color: #d5e5dd;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 9px;
    color: #f3f7f4;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.25s ease;
}

.sidebar-menu a span {
    width: 18px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.12);
    padding-left: 19px;
}

.sidebar-menu a.active {
    background: var(--secondary);
    color: white;
    font-weight: bold;
}

.sidebar-menu a.logout-link {
    margin-top: 15px;
    color: #ffe2df;
}

.sidebar-menu a.logout-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-footer p {
    font-size: 12px;
    margin-bottom: 5px;
    color: white;
}

.sidebar-footer small {
    font-size: 10px;
    color: #d0e0d7;
}


/* =========================================
   5. HEADER DASHBOARD
========================================= */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.header h1 {
    font-size: 27px;
    color: var(--primary);
    margin-bottom: 7px;
}

.header p {
    font-size: 14px;
    color: var(--muted);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 11px;
    background: white;
    padding: 9px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.user-avatar {
    width: 39px;
    height: 39px;
    background: var(--light-green);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: bold;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    font-size: 13px;
    color: var(--primary);
}

.user-info span {
    font-size: 11px;
    color: var(--muted);
}


/* =========================================
   6. BANNER SELAMAT DATANG
========================================= */

.welcome-section {
    background: linear-gradient(120deg, #315c52, #52796b);
    border-radius: 16px;
    padding: 30px;
    min-height: 140px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    gap: 20px;
    margin-bottom: 30px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 7px 20px rgba(49, 92, 82, 0.13);
}

.welcome-text {
    position: relative;
    z-index: 1;
}

.welcome-label {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: bold;
    color: #d5e7dc;
    margin-bottom: 12px;
}

.welcome-section h2 {
    font-size: 23px;
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 13px;
    line-height: 1.7;
    color: #edf5ef;
    max-width: 600px;
}

.welcome-icon {
    font-size: 65px;
    opacity: 0.9;
    margin-left: 20px;
    flex-shrink: 0;
    animation: floatBook 3s ease-in-out infinite;
}


/* =========================================
   7. TOMBOL PINJAM DASHBOARD
========================================= */

.btn-pinjam-dashboard {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 12px 20px;
    background: white;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
    transition: 0.3s;
}

.btn-pinjam-dashboard:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}


/* =========================================
   8. KARTU STATISTIK
========================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 22px 18px;
    min-height: 135px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(39, 76, 62, 0.10);
}

.stat-icon {
    width: 43px;
    height: 43px;
    min-width: 43px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-book {
    background: #e9f3ed;
    color: #315c52;
}

.icon-active {
    background: #edf1f8;
    color: #536d9a;
}

.icon-return {
    background: #fdf4e4;
    color: #b88b38;
}

.icon-borrow {
    background: #eaf2ed;
    color: #315c52;
    font-size: 16px;
    font-weight: bold;
}

.stat-card p {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 7px;
    line-height: 1.4;
}

.stat-card h3 {
    font-size: 24px;
    color: var(--primary);
    overflow-wrap: anywhere;
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}


/* =========================================
   9. PANEL DAN RIWAYAT
========================================= */

.content-panel {
    background: white;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
}

.panel-heading h2,
.panel-heading h3 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 7px;
}

.panel-heading p {
    font-size: 12px;
    color: var(--muted);
}

.see-all {
    color: var(--secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    transition: 0.2s;
}

.see-all:hover {
    color: var(--primary);
}


/* =========================================
   10. TABEL RIWAYAT PEMINJAMAN
========================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.transaction-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.transaction-table thead {
    background: #f1f6f2;
}

.transaction-table th {
    color: var(--primary);
    font-size: 12px;
    font-weight: bold;
    text-align: left;
    padding: 15px 12px;
    white-space: nowrap;
}

.transaction-table td {
    padding: 15px 12px;
    font-size: 12px;
    color: #53665c;
    border-bottom: 1px solid #edf1ee;
}

.transaction-table tbody tr {
    transition: background 0.2s;
}

.transaction-table tbody tr:hover {
    background: #f8faf8;
}

.transaction-table tbody tr:last-child td {
    border-bottom: none;
}

.transaction-table .book-title,
.book-title {
    color: var(--primary);
    font-weight: bold;
}

.empty-data {
    text-align: center;
    padding: 35px !important;
    color: var(--muted) !important;
}


/* =========================================
   11. BADGE STATUS
========================================= */

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
}

.status-dipinjam {
    background: #e8f2ec;
    color: #315c52;
}

.status-menunggu_pengembalian {
    background: #fff4dd;
    color: #a77a24;
}

.status-dikembalikan {
    background: #e7f4ec;
    color: #28734e;
}

.status-hilang {
    background: #fdebea;
    color: #b8423d;
}

.status-menunggu {
    background: #fff4dd;
    color: #a77a24;
}

.status-ditolak {
    background: #fdebea;
    color: #b8423d;
}

.status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status.dipinjam {
    background: #e8f2ec;
    color: #315c52;
}

.status.dikembalikan {
    background: #e7f4ec;
    color: #28734e;
}

.status.hilang {
    background: #fdebea;
    color: #b8423d;
}


/* =========================================
   12. ANIMASI
========================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatBook {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================
   13. TOMBOL HAMBURGER DAN OVERLAY
========================================= */

.mobile-menu-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
}


/* =========================================
   14. RESPONSIVE TABLET
========================================= */

@media (max-width: 1100px) {

    body:not(.login-body) .main-content {
        padding: 30px 25px;
    }

    body:not(.login-body) .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================
   15. RESPONSIVE MOBILE / HAMBURGER
========================================= */

@media (max-width: 768px) {

    body:not(.login-body) .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1200;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 10px;
        background: var(--primary);
        color: white;
        font-size: 23px;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    body:not(.login-body) .sidebar {
        width: 250px;
        min-width: 250px;
        height: 100vh;
        height: 100dvh;
        position: fixed;
        top: 0;
        left: 0;
        padding: 25px 18px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1100;
    }

    body:not(.login-body) .sidebar.mobile-open,
    body:not(.login-body) .sidebar.active {
        transform: translateX(0);
    }

    body:not(.login-body) .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: 0.3s;
        z-index: 1000;
    }

    body:not(.login-body) .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    body:not(.login-body) .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        padding: 75px 18px 25px;
    }

    body:not(.login-body) .header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    body:not(.login-body) .header h1 {
        font-size: 22px;
    }

    body:not(.login-body) .welcome-section {
        padding: 23px;
    }

    body:not(.login-body) .welcome-section h2 {
        font-size: 19px;
    }

    body:not(.login-body) .welcome-icon {
        font-size: 48px;
    }

    body:not(.login-body) .stat-card {
        padding: 17px 13px;
    }

    body:not(.login-body) .content-panel {
        padding: 18px;
    }

    body:not(.login-body) .dashboard-container {
        width: 100%;
        overflow-x: hidden;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}


/* =========================================
   16. RESPONSIVE LAYAR KECIL
========================================= */

@media (max-width: 550px) {

    body:not(.login-body) .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 70px 14px 20px;
    }

    body:not(.login-body) .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    body:not(.login-body) .header-user {
        width: 100%;
    }

    body:not(.login-body) .welcome-section {
        padding: 20px;
    }

    body:not(.login-body) .welcome-section h2 {
        font-size: 17px;
    }

    body:not(.login-body) .welcome-section p {
        font-size: 11px;
    }

    body:not(.login-body) .welcome-icon {
        font-size: 35px;
    }

    body:not(.login-body) .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    body:not(.login-body) .stat-card {
        min-height: 95px;
    }

    body:not(.login-body) .panel-heading {
        align-items: flex-start;
    }

    body:not(.login-body) .panel-heading h2,
    body:not(.login-body) .panel-heading h3 {
        font-size: 15px;
    }

    body:not(.login-body) .panel-heading p {
        font-size: 11px;
    }

    body:not(.login-body) .content-panel {
        padding: 15px;
    }
}


/* =========================================
   17. REDUKSI ANIMASI
========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
