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

:root {
    /* Brand Palette */
    --cinnabar: #eb3f37;
    --cod-gray: #161616;
    --red-oxide: #610805;
    --tundora: #464545;
    --well-read: #ad3033;
    --aubergine: #410d09;
    --thunderbird: #b41c1b;
    --tamarillo: #8c100e;

    /* Light Mode Mapping */
    --primary: var(--thunderbird);
    --primary-hover: var(--tamarillo);
    --bg-body: #ffffff;
    --bg-surface: #f4f4f5;
    /* Light gray to contrast with white cards */
    --card-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(22, 22, 22, 0.08);
    /* Using Cod Gray for borders */
    --text-main: var(--cod-gray);
    --text-muted: var(--tundora);
    --text-on-primary: #ffffff;
    --danger: var(--cinnabar);

    --font-family: 'Poppins', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    /* Dark Mode Mapping */
    --primary: var(--cinnabar);
    --primary-hover: var(--well-read);

    /* Using Cod Gray (#161616) as the main background anchor */
    --bg-body: #000000;
    --bg-surface: var(--cod-gray);
    --card-bg: #1e1e1e;
    /* Slightly lighter than Cod Gray for card separation */

    /* Optional: Tint glass with Aubergine for brand feel? Keeping neutral for now */
    --glass-bg: rgba(30, 30, 30, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);

    --text-main: #f3f4f6;
    --text-muted: #a3a3a3;
    --text-on-primary: #ffffff;
    --danger: #f87171;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism */
.glass {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    /* More rounded */
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

/* Typography Helpers */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.text-muted {
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    /* Slightly sharper for vintage feel */
    padding: 12px 24px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(180, 28, 27, 0.2);
    /* Red tinted shadow */
}


.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--text-muted);
    border-radius: 6px;
    padding: 12px 24px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(180, 28, 27, 0.05);
    /* Thunderbird tint */
}

/* Login Page */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-body);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    padding-right: 50px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    margin-bottom: 40px;
    text-align: center;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

button {
    font-family: 'poppins', sans-serif;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    margin-right: 10px;
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(180, 28, 27, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Layout Structure */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    height: 64px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 20%;
    right: 0;
    width: 77%;
    z-index: 1100;
    transition: all 0.3s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: none;
    /* Hidden by default */
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--bg-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.layout-wrapper {
    display: flex;
    flex: 1;
    margin-top: 64px;
    /* Offset for topbar */
}

.sidebar {
    width: 20%;
    background: var(--cod-gray);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-menu {
    padding: 24px 12px;
    padding-top: 0px;
    margin-top: 0;

}

.menu-item {
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 6px;
    color: #a3a3a3;
    /* Light gray for dark sidebar */
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.menu-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    color: #ffffff;
    background: var(--thunderbird);
    /* Brand Red for active item */
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-item-icon {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

.logout-btn {
    width: 41%;
    background: transparent;
    border: none;
    color: #a3a3a3;
    cursor: pointer;
    text-align: left;
    font-family: 'poppins', sans-serif;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: absolute;
    right: 12px;

}

.logout-btn:hover {
    color: #ffffff;
    background: rgba(235, 63, 55, 0.1);
    /* Cinnabar tint */
}

.main-content {
    flex: 1;
    margin-left: 20%;
    width: 80%;
    padding: 40px;
    background: var(--bg-surface);
    min-height: calc(100vh - 64px);
    transition: all 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    .sidebar {
        left: -100%;
        width: 280px;
        /* Standard width for mobile */
        top: 64px;
        /* Below topbar on mobile if we want topbar to cover */
        height: calc(100vh - 64px);
    }

    .sidebar.active {
        left: 0;
    }

    .topbar {
        left: 0;
        width: 100%;
    }

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

    .menu-toggle {
        display: block;
    }
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--thunderbird);
    opacity: 1;
    transition: opacity 0.3s ease;
}


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

.stat-card:hover::after {
    opacity: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-value {
    color: var(--text-main);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 50px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 30px;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
}

/* Mobile */
.mobile-nav {
    display: none;
    background: var(--card-bg);
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
    justify-content: space-between;
}