/* assets/css/style.css */
:root {
    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --secondary-color: #64748b;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --border: #334155;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-main);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Auth / Login Page */
.auth-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
    font-size: 1.875rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-card p {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

/* Dashboard Layout */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--card-bg);
    position: fixed;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.main-content {
    margin-left: 260px;
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Hamburger Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--primary-color);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
}

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

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Flex Layout Helpers */
.page-flex {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th {
    background: #111827;
    text-align: left;
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.badge-success { background: #065f46; color: #34d399; }
.badge-warning { background: #78350f; color: #fbbf24; }
.badge-danger { background: #7f1d1d; color: #f87171; }

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    /* Show hamburger */
    .mobile-menu-btn {
        display: flex;
    }

    /* Hide sidebar off-screen by default */
    .sidebar {
        transform: translateX(-100%);
    }

    /* Show sidebar when toggled */
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    /* Main content takes full width */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem; /* Space for hamburger */
    }

    /* Header flex */
    .main-content > header {
        flex-direction: column !important;
        gap: 0.5rem;
        align-items: flex-start !important;
    }

    .main-content > header h2 {
        font-size: 1.25rem;
    }

    /* Flex layouts stack vertically */
    .page-flex,
    [style*="display: flex"][style*="gap: 2rem"] {
        flex-direction: column !important;
    }

    /* Stat cards grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.25rem;
    }

    /* Tables - horizontal scroll */
    .table-container {
        border-radius: 0.75rem;
    }

    table {
        min-width: 500px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    /* Buttons */
    .btn {
        padding: 0.875rem;
        font-size: 0.9375rem;
    }

    /* Forms */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem; /* Prevent iOS zoom */
    }

    /* Auth card */
    .auth-card {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    /* Calendar - Specific responsive styles */
    .calendar-container {
        grid-template-columns: 50px repeat(7, 1fr) !important;
        font-size: 0.6875rem;
    }

    .calendar-header > div {
        font-size: 0.625rem;
        padding: 0.25rem;
    }

    .time-label {
        font-size: 0.625rem;
    }

    .lesson-card {
        font-size: 0.625rem;
        padding: 0.25rem;
    }

    /* Schedule top controls */
    .schedule-controls {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .schedule-controls .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    /* Modals */
    [id$="-modal"] > div,
    [id*="modal"] > div {
        width: 90% !important;
        max-width: 400px;
        max-height: 90vh;
        overflow-y: auto;
        margin: 1rem;
    }

    /* Dashboard flex -> stack */
    .dashboard-layout {
        flex-direction: column !important;
    }

    /* Select elements full width */
    select {
        max-width: 100%;
    }

    /* Grid 2-col forms become 1-col */
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

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

    .main-content {
        padding: 0.75rem;
        padding-top: 4rem;
    }

    .auth-card h1 {
        font-size: 1.5rem;
    }

    table {
        min-width: 400px;
    }
}
