@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

:root {
    --primary: #111A5E;
    --primary-dark: #080D3D;
    --accent: #27D3B2;
    --accent-dark: #18B899;

    --bg: #F5F7FB;
    --surface: #FFFFFF;
    --sidebar: #FFFFFF;

    --text: #111A3A;
    --text-light: #68708A;

    --border: #E3E7F0;

    --success: #27D3B2;
    --warning: #F4B740;
    --danger: #E85D75;

    --shadow: 0 10px 30px rgba(17, 26, 94, .08);
    --radius: 18px;
    --transition: .25s ease;
}

body.dark-mode {
    --bg: #080D22;
    --surface: #111A3A;
    --sidebar: #0B1230;

    --text: #F8FAFF;
    --text-light: #B8C0D8;

    --border: #263152;
    --shadow: 0 15px 35px rgba(0, 0, 0, .35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .25s ease, color .25s ease;
}

h1, h2, h3, h4, h5 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    width: 100%;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: .2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(39, 211, 178, .14);
}

.container {
    width: min(1200px, 92%);
    margin: auto;
}

.btn, .primary-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    transition: var(--transition);
}

.btn:hover, .primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--accent);
    color: var(--primary);
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: var(--transition);
}

.text-center { text-align: center; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mt-4 { margin-top: 40px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.mb-4 { margin-bottom: 40px; }

.flex { display: flex; }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.logo-box {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.subtitle {
    color: var(--text-light);
    font-size: .95rem;
}

.hidden { display: none; }

.fade-in {
    animation: fade .5s ease;
}

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

/* =========================
   SIDEBAR
========================= */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    padding: 25px 20px;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 35px;
}

.logo-text {
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a,
.sidebar-menu .logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    color: var(--text-light);
    font-weight: 500;
    transition: var(--transition);
    background: transparent;
    text-align: left;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(39, 211, 178, .12);
    color: var(--primary);
}

.sidebar-menu .logout:hover {
    background: rgba(232, 93, 117, .10);
    color: var(--danger);
}

/* =========================
   MAIN
========================= */

.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.theme-toggle {
    width: 50px;
    height: 28px;
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 14px;
}

.theme-toggle:hover {
    background: var(--accent);
    color: var(--primary);
}

.page-title {
    font-size: 32px;
    margin-bottom: 8px;
}

.page-description {
    color: var(--text-light);
}

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

.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-info h3 {
    font-size: 28px;
    margin-top: 10px;
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(39, 211, 178, .13);
    color: var(--accent-dark);
    font-size: 22px;
}

/* =========================
   CHARTS
========================= */

.dashboard-charts {
    margin-top: 25px;
}

.chart-card {
    min-height: 350px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-area {
    height: 280px;
    position: relative;
}

/* =========================
   TABLES / GENERAL MODULES
========================= */

.table-container,
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 16px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

tr:hover,
tbody tr:hover {
    background: rgba(39, 211, 178, .05);
}

.dashboard-page {
    padding: 25px;
}

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

.page-header h1 {
    font-size: 32px;
}

.page-header p {
    color: var(--text-light);
    margin-top: 6px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.content-card,
.stat-card {
    background: var(--surface);
}

.content-card {
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.table-header input {
    width: 260px;
}

.status-success {
    background: rgba(39, 211, 178, .15);
    color: var(--accent-dark);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.status-danger {
    background: rgba(232, 93, 117, .15);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

/* =========================
   MODAL
========================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    align-items: center;
    justify-content: center;
    z-index: 5000;
    backdrop-filter: blur(5px);
}

.modal-box {
    width: 420px;
    max-width: 90%;
    padding: 30px;
    border-radius: 22px;
    background: var(--surface);
}

/* =========================
   AUTH PAGES
========================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    background:
        radial-gradient(circle at top left, rgba(39, 211, 178, .12), transparent 35%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 430px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-brand-logo {
    width: 180px;
    height: 120px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
}

.auth-brand-name {
    color: var(--primary);
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 700;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: .9rem;
    font-weight: 600;
}

/* =========================
   MOBILE BOTTOM NAV
========================= */

.mobile-nav {
    display: none;
}

.more-menu {
    position: fixed;
    bottom: 88px;
    left: 15px;
    right: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 9999;
}

.more-menu.show {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.more-menu a,
.more-menu .logout {
    display: block;
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    text-align: left;
}

.more-menu a:hover,
.more-menu .logout:hover {
    background: rgba(39, 211, 178, .10);
}

/* =========================
   DARK MODE
========================= */

body.dark-mode .sidebar-menu a:hover,
body.dark-mode .sidebar-menu a.active {
    color: var(--accent);
}

body.dark-mode .logo-text {
    color: #fff;
}

body.dark-mode .auth-brand-name {
    color: #fff;
}

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

@media (max-width: 1100px) {
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }

    .sidebar .logo-text,
    .sidebar-menu a span:not(:first-child) {
        display: none;
    }

    .sidebar-menu a,
    .sidebar-menu .logout {
        justify-content: center;
        padding: 14px 8px;
    }

    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .grid-3,
    .stats-container {
        grid-template-columns: 1fr;
    }

    .page-header,
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-header input {
        width: 100%;
    }

    .dashboard-page {
        padding: 16px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .topbar {
        align-items: flex-start;
        gap: 15px;
    }

    .page-title {
        font-size: 27px;
    }

    .stat-card {
        flex-direction: row;
    }

    .mobile-nav {
        position: fixed;
        display: flex;
        bottom: 15px;
        left: 15px;
        right: 15px;
        height: 65px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 22px;
        justify-content: space-around;
        align-items: center;
        box-shadow: var(--shadow);
        z-index: 200;
    }

    .mobile-nav a,
    .mobile-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        font-size: .75rem;
        color: var(--text-light);
        background: transparent;
    }

    .mobile-nav a.active,
    .mobile-nav button:hover {
        color: var(--accent);
    }

    body {
        padding-bottom: 90px;
    }

    .chart-card {
        min-height: 320px;
    }

    .chart-area {
        height: 250px;
    }
}
