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

:root {
    /* Premium Design System Tokens (User Vers.) */
    --primary: #f59e0b;
    --primary-light: #fbbf24;
    --primary-glow: rgba(245, 158, 11, 0.4);
    --secondary: #10b981;
    --accent: #6366f1;
    --danger: #ef4444;

    --bg-main: #fcfcfd;
    --bg-sidebar: #09090b;
    --bg-card: #ffffff;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.08);

    --text-main: #09090b;
    --text-sec: #4b5563;
    --text-muted: #94a3b8;
    --text-on-dark: #f1f5f9;

    --border-light: rgba(226, 232, 240, 0.8);
    --border: rgba(226, 232, 240, 0.8);
    /* Alias for backward compatibility */
    --border-sidebar: rgba(255, 255, 255, 0.05);

    --sidebar-width: 280px;
    --header-height: 80px;

    --radius-full: 9999px;
    --radius-2xl: 1.5rem;
    --radius-xl: 1.25rem;
    --radius-lg: 1rem;
    --radius-md: 0.75rem;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.06);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

button,
input {
    font-family: inherit;
}

/* Brand logo typography (ensures full text visibility on small screens) */
.brand-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.1;
    min-width: 0;
}

@media (max-width: 480px) {
    .brand-logo {
        font-size: 1.05rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

/* Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.dashboard-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
}

.sidebar-header {
    min-height: var(--header-height);
    height: auto;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: inherit;
    flex: 1 1 auto;
    min-width: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: 0 0 20px var(--primary-glow);
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: #fff;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 1.5rem 1rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: var(--transition-base);
    margin-bottom: 0.25rem;
}

.nav-link i {
    width: 20px;
    height: 20px;
    transition: var(--transition-base);
}

.nav-link:hover {
    color: #fff;
    background: var(--bg-sidebar-hover);
}

.nav-link.active {
    background: #fff;
    color: #000;
    font-weight: 700;
    box-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.1);
}

.nav-link.active i {
    color: var(--primary);
}

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-sidebar);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    transition: var(--transition-slow);
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    height: var(--header-height);
}

.header-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.header-title p {
    font-size: 0.9375rem;
    color: var(--text-sec);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sec);
    cursor: pointer;
    position: relative;
    transition: var(--transition-base);
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.notification-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border: 2px solid #fff;
    border-radius: 50%;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    padding-right: 1.25rem;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-base);
}

.user-pill:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-premium);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #d97706);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-premium);
    border-color: var(--primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.stat-details h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-sec);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
    line-height: 1;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.section-card {
    background: #fff;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-light);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.col-8 {
    grid-column: span 8;
}

.col-4 {
    grid-column: span 4;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-sec);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.modern-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-sec);
    white-space: nowrap;
}


.modern-table tr:hover td {
    background: #fafafa;
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--primary-glow);
}

/* Sidebar Overlay */
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .col-8,
    .col-4 {
        grid-column: span 12;
    }
}

@media (max-width: 1024px) {
    .dashboard-sidebar {
        transform: translateX(-100%);
    }

    .dashboard-sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.2);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
}

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

    .header-actions {
        flex-wrap: wrap;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 360px) {
    .brand-name {
        font-size: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .section-card {
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .header-title h1 {
        font-size: 1.25rem;
        word-break: break-word;
        white-space: normal;
    }

    .header-title p {
        font-size: 0.75rem;
        word-break: break-word;
        white-space: normal;
    }
}

/* Utility display classes (no Tailwind dependency) */
.hidden {
    display: none !important;
}

/* On >=1024px: hide the hamburger menu button */
@media (min-width: 1025px) {
    .lg\:hidden {
        display: none !important;
    }
}

/* On >=640px: show sm:flex and sm:block */
@media (min-width: 640px) {
    .sm\:flex {
        display: flex !important;
    }

    .sm\:block {
        display: block !important;
    }
}

/* On >=768px: show md:flex and md:block */
@media (min-width: 768px) {
    .md\:flex {
        display: flex !important;
    }

    .md\:block {
        display: block !important;
    }
}