/**
 * SMARTGRADEAI - PREMIUM STYLESHEET (V2)
 * Modern Material Design Inspired
 * Fully Responsive Mobile-First
 */

/* ==========================================
   1. VARIABLES & THEME
   ========================================== */
:root {
    /* Brand Colors (Politeknik Theme) */
    --primary: #0d47a1;        /* Deep Blue */
    --primary-light: #5472d3;
    --primary-dark: #002171;
    --secondary: #ffab00;      /* Amber/Gold */

    /* UI Colors */
    --bg-body: #f0f2f5;        /* Light Grey Background */
    --bg-paper: #ffffff;       /* Card White */
    --bg-sidebar: #1e293b;     /* Dark Slate */

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #ffffff;

    /* Functional Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Dimensions */
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 12px;

    /* Shadows (Soft & Modern) */
    --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);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   2. RESET & BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; }

/* ==========================================
   3. LAYOUT STRUCTURE (Grid System)
   ========================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Header / Navbar */
.navbar {
    height: var(--header-height);
    background: var(--bg-paper);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

/* Content Container */
.container {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

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

/* ==========================================
   4. COMPONENT: SIDEBAR
   ========================================== */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    padding: 16px 24px 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-light);
}

.nav-item.active {
    background: rgba(var(--primary-light), 0.1);
    color: #ffffff; /* Explicitly white text for active */
    border-left-color: var(--secondary);
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

.nav-item .icon {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
}

/* ==========================================
   5. COMPONENT: NAVBAR
   ========================================== */
.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: none; /* Hidden on desktop */
}

.menu-toggle:hover { background-color: var(--bg-body); color: var(--primary); }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: var(--transition);
}

.user-profile:hover { background-color: var(--bg-body); }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-body);
    box-shadow: var(--shadow-sm);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 70px;
    right: 20px;
    background: var(--bg-paper);
    width: 220px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.05);
}

.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dropdown-item:hover { background-color: var(--bg-body); color: var(--primary); }

/* ==========================================
   6. COMPONENT: CARDS & STATS
   ========================================== */
.card {
    background: var(--bg-paper);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 0; /* Let children handle padding */
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.02);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-body);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; background-color: #fafafa; border-top: 1px solid var(--bg-body); }

/* Stat Card */
.stat-card {
    display: flex;
    align-items: center;
    padding: 24px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-right: 20px;
}

.stat-icon.primary { background-color: rgba(13, 71, 161, 0.1); color: var(--primary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.error   { background-color: rgba(239, 68, 68, 0.1); color: var(--error); }

.stat-content h3 { font-size: 1.8rem; font-weight: 700; margin-bottom: 4px; line-height: 1; }
.stat-content p { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }

/* ==========================================
   7. COMPONENT: BUTTONS & FORMS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 8px;
}

.btn-primary { background-color: var(--primary); color: white; box-shadow: 0 2px 4px rgba(13, 71, 161, 0.2); }
.btn-primary:hover { background-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(13, 71, 161, 0.3); }

.btn-secondary { background-color: white; color: var(--text-primary); border: 1px solid #e2e8f0; }
.btn-secondary:hover { background-color: #f8fafc; border-color: #cbd5e1; }

.btn-block { width: 100%; }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: #ffffff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

.form-label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-primary); font-size: 0.9rem; }

/* ==========================================
   8. COMPONENT: TABLES (Responsive)
   ========================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 16px 24px;
    text-align: left;
}

.table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}

.table tr:last-child td { border-bottom: none; }

/* ==========================================
   9. RESPONSIVE MEDIA QUERIES (Mobile Magic)
   ========================================== */
/* Tablet & Mobile */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 0px; /* Sidebar hidden by default */
    }

    .menu-toggle { display: block; } /* Show Hamburger */

    .sidebar {
        transform: translateX(-100%);
        width: 280px; /* Width when open */
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }

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

    /* Overlay when sidebar open */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 45;
        display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar.open + .sidebar-overlay { display: block; }
}

/* Mobile Phones */
@media (max-width: 576px) {
    .container { padding: 16px; }

    .navbar { padding: 0 16px; }

    .card-body { padding: 16px; }

    /* Stack Grid Columns */
    .row { display: flex; flex-direction: column; }
    .col { width: 100% !important; margin-bottom: 16px; }

    /* Responsive Table Card View */
    .table thead { display: none; }
    .table tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 16px;
        background: white;
    }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 8px 0;
        font-size: 0.9rem;
    }
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        margin-right: 12px;
    }

    /* Adjust Fonts */
    h1 { font-size: 1.5rem; }
    .stat-content h3 { font-size: 1.5rem; }
}

/* ==========================================
   10. UTILITIES
   ========================================== */
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col { flex: 1; padding: 0 12px; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

.gap-md { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-lg { margin-bottom: 24px; }
.mt-md { margin-top: 16px; }

/* Badge */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-error { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--info); }
