/* ========================================
   EDUQUEST LMS - COMPLETE RESPONSIVE CSS
   Mobile-First Design
   ======================================== */

/* CSS Variables */
:root {
    --primary: #0a7a3d;
    --primary-dark: #065c2e;
    --primary-light: #e8f5e9;
    --secondary: #6c757d;
    --secondary-dark: #5a6268;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #343a40;
    --light: #f8f9fa;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --box-shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
    min-height: 100vh;
}

/* ========================================
   TYPOGRAPHY - Mobile First
   ======================================== */
h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }
h5 { font-size: 1rem; margin-bottom: 0.5rem; }
h6 { font-size: 0.9rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

/* Tablet and up */
@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    body { font-size: 16px; }
}

/* ========================================
   LAYOUT - Mobile First
   ======================================== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Mobile: Sidebar hidden by default, shown as overlay */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: var(--box-shadow-lg);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile menu button */
.menu-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    border: none;
    color: white;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main content - mobile */
.main-content {
    flex: 1;
    padding: 80px 16px 20px;
    width: 100%;
    transition: var(--transition);
}

/* Desktop layout */
@media (min-width: 992px) {
    .dashboard-container {
        flex-direction: row;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .sidebar {
        position: sticky;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        box-shadow: var(--box-shadow);
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 24px;
    }
}

/* ========================================
   HEADER - Mobile Responsive
   ======================================== */
.header {
    background: white;
    padding: 12px 16px;
    box-shadow: var(--box-shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo h1 {
    font-size: 1.2rem;
    margin: 0;
}

.header-logo p {
    font-size: 0.7rem;
    margin: 0;
    color: var(--gray-600);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (min-width: 992px) {
    .header {
        padding: 12px 24px;
    }
    
    .header-logo h1 {
        font-size: 1.3rem;
    }
}

/* ========================================
   CARDS - Mobile Responsive
   ======================================== */
.card, .section-card, .quiz-card, .result-card, .attempt-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--gray-200);
}

.card-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    margin-bottom: 12px;
}

.card-footer {
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

@media (min-width: 768px) {
    .card, .section-card, .quiz-card {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* Grid layouts - responsive */
.grid-2, .stats-cards, .quiz-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .grid-2, .stats-cards, .quiz-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-2, .stats-cards, .quiz-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   BUTTONS - Touch Friendly
   ======================================== */
.btn, button, .btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 44px; /* Touch-friendly size */
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover, .btn-primary:active {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
}

.btn-block {
    width: 100%;
}

/* Button groups - responsive */
.button-group, .action-buttons, .nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 640px) {
    .button-group, .action-buttons, .nav-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ========================================
   FORMS - Mobile Friendly
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-control, input, select, textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

@media (min-width: 768px) {
    .form-control, input, select, textarea {
        font-size: 14px;
    }
}

/* ========================================
   TABLES - Responsive (Horizontal Scroll)
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-100);
    font-weight: 600;
}

@media (min-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 12px 16px;
    }
}

/* Stack tables on mobile */
@media (max-width: 640px) {
    .data-table thead {
        display: none;
    }
    
    .data-table tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--gray-300);
        border-radius: var(--border-radius);
    }
    
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 12px;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .data-table td:last-child {
        border-bottom: none;
    }
    
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 10px;
    }
}

/* ========================================
   QUIZ & TEST PAGES - Responsive
   ======================================== */
.quiz-container, .test-container, .results-container {
    max-width: 100%;
    padding: 0;
}

.quiz-header, .test-header, .result-header {
    padding: 20px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.question-card {
    padding: 16px;
    margin-bottom: 16px;
}

.option-item {
    padding: 12px;
    margin-bottom: 10px;
}

.option-item input[type="radio"] {
    width: auto;
    margin-right: 12px;
}

.timer-container {
    padding: 10px 12px;
    margin-top: 12px;
}

.timer-display {
    font-size: 1.2rem;
    padding: 4px 12px;
}

@media (min-width: 768px) {
    .quiz-container, .test-container, .results-container {
        max-width: 900px;
        margin: 0 auto;
    }
    
    .quiz-header, .test-header, .result-header {
        padding: 24px;
    }
    
    .question-card {
        padding: 24px;
    }
    
    .timer-display {
        font-size: 1.5rem;
    }
}

/* ========================================
   DASHBOARD CARDS - Responsive
   ======================================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 16px 12px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
}

@media (min-width: 768px) {
    .dashboard-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 2.2rem;
    }
}

/* ========================================
   FILTER BAR - Responsive
   ======================================== */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.filter-group {
    width: 100%;
}

.filter-group select {
    width: 100%;
}

@media (min-width: 768px) {
    .filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
    }
    
    .filter-group {
        flex: 1;
        min-width: 150px;
    }
}

/* ========================================
   MODAL - Mobile Friendly
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ========================================
   NOTIFICATIONS & ALERTS
   ======================================== */
.alert, .success-message, .error-message, .warning-message {
    padding: 14px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success);
}

.error-message, .danger-message {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger);
}

.warning-message {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.hide-mobile { display: none; }
.show-mobile { display: block; }

@media (min-width: 768px) {
    .hide-mobile { display: block; }
    .show-mobile { display: none; }
}

/* ========================================
   BADGES & STATUS
   ======================================== */
.badge, .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending, .badge-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved, .status-paid, .status-success {
    background: #d4edda;
    color: #155724;
}

.status-rejected, .status-cancelled, .status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-inprogress, .status-scheduled {
    background: #cce5ff;
    color: #004085;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   PRINT STYLES (for invoices)
   ======================================== */
@media print {
    .sidebar, .menu-toggle, .header, .nav-buttons, .btn, button, .no-print {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
        margin: 0;
    }
    
    .card, .section-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   TOUCH-FRIENDLY IMPROVEMENTS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets for mobile */
    .btn, button, .clickable, a {
        min-height: 44px;
    }
    
    /* Remove hover effects on mobile */
    .btn:hover, button:hover {
        transform: none;
    }
    
    /* Better scrolling for touch */
    .overflow-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE BREAKPOINTS SUMMARY
   ======================================== */
/* Mobile: 0 - 639px */
/* Tablet: 640px - 991px */
/* Desktop: 992px - 1199px */
/* Wide: 1200px+ */