/* ==================== PREMIUM MODERN DESIGN SYSTEM ==================== */

:root {
    /* Refined Palette - "Sandalwood & Slate" */
    --primary: #c19260;
    --primary-light: #fdf2e9;
    --primary-dark: #8b6f47;
    --primary-vibrant: #d97706; /* For eye-catching accents */
    
    --secondary: #0f172a;    /* Deep Slate */
    
    /* Surface Colors */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    
    /* Text Hierarchy */
    --text-main: #1e293b;    /* Slate 800 */
    --text-muted: #64748b;   /* Slate 500 */
    --text-light: #94a3b8;   /* Slate 400 */
    
    /* Sophisticated Accents */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Elevated Shadows (Layered for realism) */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    /* Geometric Tokens */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== GLOBAL STYLES ==================== */

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ==================== LAYOUT: SIDEBAR ==================== */

.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
}

.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid #e2e8f0;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
    z-index: 50;
    transition: var(--transition);
}

/* Custom Scrollbar Styling */
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 0.5rem;
    margin-bottom: 2.5rem;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.sidebar-brand h1 {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: -0.02em;
}

.sidebar-brand .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-item-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: var(--text-light);
    font-weight: 700;
    margin: 1.5rem 0.75rem 0.5rem;
}

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

.nav-link i {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.nav-link:hover {
    background-color: #f1f5f9;
    color: var(--secondary);
}

.nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

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

.nav-link-logout {
    margin-top: auto;
    color: var(--error);
    border: 1px solid transparent;
}

.nav-link-logout:hover {
    background-color: #fef2f2;
    border-color: #fee2e2;
}

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

.main-content {
    padding: 2.5rem 3.5rem;
    max-width: 100%;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.page.active { display: block; }

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

.page-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: -0.025em;
}

/* ==================== DASHBOARD COMPONENTS ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: var(--transition);
}

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

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

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background-color: #f8fafc;
    color: var(--primary);
}

.stat-card:nth-child(2) .stat-icon-wrapper { background-color: #ecfdf5; color: var(--success); }
.stat-card:nth-child(3) .stat-icon-wrapper { background-color: #eff6ff; color: var(--info); }
.stat-card:nth-child(4) .stat-icon-wrapper { background-color: #fef2f2; color: var(--error); }

.stat-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--secondary);
    margin-top: 0.25rem;
}

/* ==================== CARDS & FORMS ==================== */

.card {
    background: var(--bg-card);
    padding: 2.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
    margin-bottom: 2rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #fff;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(193, 146, 96, 0.1);
}

/* ==================== BUTTONS ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-size: 0.935rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid transparent;
}

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

.btn-primary:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: white;
    border-color: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

/* ==================== TABLES ==================== */

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: var(--radius);
    border: 1px solid #f1f5f9;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: white;
}

th {
    background-color: #f8fafc;
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

td {
    padding: 1.125rem 1.25rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

tr:hover td {
    background-color: #fafbfc;
}

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

.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

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

@media (max-width: 1024px) {
    .app-container { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { padding: 1.5rem; }
}
