/**
 * CyberForge Academy - Premium iOS-Style CSS
 * Dark-first theme with glassmorphism effects
 * No external frameworks - 100% custom
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    /* iOS Color Palette */
    --ios-blue: #4B5320;
    --ios-blue-light: #6B7C2A;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-yellow: #FFCC00;
    --ios-purple: #AF52DE;
    --ios-pink: #FF2D55;
    --ios-teal: #5AC8FA;
    --ios-indigo: #5856D6;
    
    /* Dark Theme Colors */
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --bg-elevated: #3A3A3C;
    
    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #EBEBF5;
    --text-tertiary: #EBEBF599;
    --text-quaternary: #EBEBF54D;
    
    /* Glassmorphism */
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(75, 83, 32, 0.3);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Typography */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-stack);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ios-blue);
}

/* Selection */
::selection {
    background: rgba(75, 83, 32, 0.3);
    color: var(--text-primary);
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

a {
    color: var(--ios-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--ios-blue-light);
}

code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
}

pre {
    font-family: var(--font-mono);
    background: var(--bg-secondary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-md);
}

pre code {
    background: transparent;
    padding: 0;
}

/* ==================== GLASSMORPHISM COMPONENTS ==================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background: var(--ios-blue-light);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
}

.btn-success {
    background: var(--ios-green);
    color: white;
}

.btn-danger {
    background: var(--ios-red);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--ios-blue);
    border: 1px solid var(--ios-blue);
}

.btn-outline:hover {
    background: rgba(75, 83, 32, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-quaternary);
}

.form-input:focus {
    outline: none;
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 3px rgba(75, 83, 32, 0.2);
}

.form-input.error {
    border-color: var(--ios-red);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.2);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FFFFFF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.form-error {
    color: var(--ios-red);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-check-input {
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.form-check-input:checked {
    background: var(--ios-blue);
    border-color: var(--ios-blue);
}

.form-check-input:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input[type="radio"]:checked::after {
    content: '';
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.card-body {
    padding: var(--space-lg);
}

.card-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

/* ==================== NAVIGATION ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-brand i {
    color: var(--ios-blue);
    font-size: 1.5rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link i {
    font-size: 1.125rem;
}

/* Hamburger - only shows when navbar-nav is hidden */
.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    z-index: 1001;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.navbar-hamburger:hover {
    background: var(--bg-tertiary);
}

/* Dropdown nav menu for tablet/desktop when hamburger is used */
.navbar-nav.open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 70px;
    right: 0;
    left: 0;
    background: rgba(0,0,0,0.97);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-md);
    gap: var(--space-sm);
    z-index: 999;
}

/* Mobile Bottom Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
    padding: var(--space-sm) 0;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    transition: color var(--transition-fast);
}

.mobile-nav-item i {
    font-size: 1.25rem;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--ios-blue);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    overflow-y: auto;
    padding: var(--space-lg);
    z-index: 100;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin-bottom: var(--space-xs);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-link i {
    width: 24px;
    text-align: center;
    color: var(--ios-blue);
}

/* ==================== LAYOUT ==================== */
.main-content {
    margin-left: 0;
    margin-top: 70px;
    padding: var(--space-xl);
    min-height: calc(100vh - 70px);
    max-width: 100%;
    overflow-x: hidden;
}

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

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .grid-3,
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Flex */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ==================== PROGRESS COMPONENTS ==================== */
.progress-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--ios-blue);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Linear Progress */
.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ios-blue), var(--ios-blue-light));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ==================== ALERTS ==================== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.alert-info {
    background: rgba(75, 83, 32, 0.1);
    border: 1px solid rgba(75, 83, 32, 0.3);
    color: var(--ios-blue);
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.3);
    color: var(--ios-green);
}

.alert-warning {
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.3);
    color: var(--ios-orange);
}

.alert-danger {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: var(--ios-red);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(75, 83, 32, 0.2);
    color: var(--ios-blue);
}

.badge-success {
    background: rgba(52, 199, 89, 0.2);
    color: var(--ios-green);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.2);
    color: var(--ios-orange);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.2);
    color: var(--ios-red);
}

/* ==================== TABLES ==================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-bounce);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 90px;
    right: var(--space-lg);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.toast {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--ios-blue);
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--ios-green); }
.toast.error { border-left-color: var(--ios-red); }
.toast.warning { border-left-color: var(--ios-orange); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

/* ==================== LOADING SPINNER ==================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--ios-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    padding: var(--space-lg);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo i {
    font-size: 4rem;
    color: var(--ios-blue);
    margin-bottom: var(--space-md);
}

.login-logo h1 {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.login-logo p {
    color: var(--text-tertiary);
}

.login-form {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
}

/* ==================== DASHBOARD ==================== */
.dashboard-header {
    margin-bottom: var(--space-xl);
}

.dashboard-header h1 {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.dashboard-header p {
    color: var(--text-tertiary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    transition: transform var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(75, 83, 32, 0.2); color: var(--ios-blue); }
.stat-icon.green { background: rgba(52, 199, 89, 0.2); color: var(--ios-green); }
.stat-icon.orange { background: rgba(255, 149, 0, 0.2); color: var(--ios-orange); }
.stat-icon.purple { background: rgba(175, 82, 222, 0.2); color: var(--ios-purple); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-content p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin: 0;
}

/* Progress Overview */
.progress-overview {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xl);
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.progress-details h3 {
    margin-bottom: var(--space-md);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.progress-stat {
    text-align: center;
}

.progress-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ios-blue);
}

.progress-stat-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* Module Cards */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.module-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    border: 1px solid transparent;
}

.module-card:hover {
    transform: translateY(-4px);
    border-color: var(--ios-blue);
    box-shadow: var(--shadow-glow);
}

.module-card-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

.module-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(75, 83, 32, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ios-blue);
    font-size: 1.25rem;
}

.module-card-title {
    flex: 1;
}

.module-card-title h4 {
    margin-bottom: 4px;
}

.module-card-title span {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.module-card-body {
    padding: var(--space-lg);
}

.module-progress {
    margin-bottom: var(--space-md);
}

.module-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    font-size: 0.875rem;
}

/* ==================== LESSON VIEWER ==================== */
.lesson-container {
    display: flex;
    gap: 0;
    max-width: 100%;
    margin: 0 auto;
}

.lesson-header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.lesson-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.lesson-breadcrumb a {
    color: var(--ios-blue);
}

.lesson-title {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.lesson-meta {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.lesson-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.lesson-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.lesson-content h2 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    color: var(--ios-blue);
}

.lesson-content h3 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.lesson-content ul,
.lesson-content ol {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.lesson-content li {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.lesson-content .concept-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border-left: 4px solid var(--ios-blue);
}

.lesson-content .concept-box h4 {
    color: var(--ios-blue);
    margin-bottom: var(--space-sm);
}

.lesson-content pre {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    overflow-x: auto;
    margin: var(--space-lg) 0;
}

.lesson-content code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.lesson-complete-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--ios-green);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lesson-complete-btn:hover {
    background: #30b350;
    transform: scale(1.02);
}

.lesson-complete-btn.completed {
    background: var(--bg-tertiary);
    color: var(--ios-green);
}

/* ==================== QUIZ STYLES ==================== */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.quiz-header h2 {
    margin-bottom: var(--space-sm);
}

.quiz-timer {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-secondary);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.quiz-timer.warning {
    background: rgba(255, 149, 0, 0.2);
    color: var(--ios-orange);
}

.quiz-timer.danger {
    background: rgba(255, 59, 48, 0.2);
    color: var(--ios-red);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.question-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.question-number {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.option-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.option-label:hover {
    background: var(--bg-elevated);
}

.option-label input:checked + .option-text {
    color: var(--ios-blue);
}

.option-label:has(input:checked) {
    border-color: var(--ios-blue);
    background: rgba(75, 83, 32, 0.1);
}

.option-radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-label:has(input:checked) .option-radio {
    border-color: var(--ios-blue);
    background: var(--ios-blue);
}

.option-label:has(input:checked) .option-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Quiz Results */
.quiz-results {
    text-align: center;
    padding: var(--space-2xl);
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    position: relative;
}

.score-circle.pass {
    background: rgba(52, 199, 89, 0.2);
    border: 4px solid var(--ios-green);
}

.score-circle.fail {
    background: rgba(255, 59, 48, 0.2);
    border: 4px solid var(--ios-red);
}

.score-value {
    font-size: 3rem;
    font-weight: 700;
}

.score-circle.pass .score-value {
    color: var(--ios-green);
}

.score-circle.fail .score-value {
    color: var(--ios-red);
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

/* ==================== EXAM STYLES ==================== */
.exam-warning {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--ios-red);
}

/* ==================== CERTIFICATE ==================== */
.certificate-preview {
    background: white;
    color: #333;
    padding: 60px;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.certificate-border {
    border: 8px solid #4B5320;
    padding: 40px;
    position: relative;
}

.certificate-border::before,
.certificate-border::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #4B5320;
}

.certificate-border::before {
    top: -8px;
    left: -8px;
    border-right: none;
    border-bottom: none;
}

.certificate-border::after {
    bottom: -8px;
    right: -8px;
    border-left: none;
    border-top: none;
}

.certificate-title {
    font-size: 2.5rem;
    color: #4B5320;
    margin-bottom: var(--space-lg);
    font-weight: 700;
}

.certificate-recipient {
    font-size: 2rem;
    margin: var(--space-xl) 0;
    font-family: 'Georgia', serif;
    font-style: italic;
}

.certificate-course {
    font-size: 1.25rem;
    margin-bottom: var(--space-lg);
}

.certificate-date {
    color: #666;
    margin-bottom: var(--space-xl);
}

.certificate-id {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: #999;
}

/* ==================== PRACTICALS ==================== */
.practical-container {
    max-width: 900px;
    margin: 0 auto;
}

.terminal {
    background: #0d1117;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    font-family: var(--font-mono);
    min-height: 300px;
}

.terminal-output {
    color: #7ee787;
    margin-bottom: var(--space-md);
    white-space: pre-wrap;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.terminal-prompt {
    color: #58a6ff;
}

.terminal-input {
    background: transparent;
    border: none;
    color: #e6edf3;
    font-family: var(--font-mono);
    flex: 1;
    outline: none;
}

/* Drag and Drop */
.drag-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
}

.drag-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.drag-item {
    background: var(--bg-tertiary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: move;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.drag-item:hover {
    border-color: var(--ios-blue);
}

.drag-item.dragging {
    opacity: 0.5;
}

.drop-zone {
    background: var(--bg-tertiary);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    min-height: 60px;
    transition: all var(--transition-fast);
}

.drop-zone.drag-over {
    border-color: var(--ios-blue);
    background: rgba(75, 83, 32, 0.1);
}

/* ==================== ADMIN PANEL ==================== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

@media (max-width: 600px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-header .btn {
        width: 100%;
    }
}

.admin-table-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar-nav {
        display: none;
    }
    
    .navbar-hamburger {
        display: block;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        margin-bottom: 90px;
        padding: var(--space-md);
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .progress-overview {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .lesson-navigation {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .lesson-navigation .btn {
        width: 100%;
    }
    
    .drag-container {
        grid-template-columns: 1fr;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fadeIn {
    animation: fadeIn 0.5s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.5s ease-out;
}

/* Stagger animation for lists */
.stagger-children > * {
    opacity: 0;
    animation: slideUp 0.5s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }

/* ==================== UTILITY CLASSES ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ============================================================
   PASSWORD VISIBILITY TOGGLE
   ============================================================ */
.pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

.pw-wrap .form-input {
    padding-right: 50px;
}

.pw-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color var(--transition-fast);
    z-index: 10;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.pw-toggle:hover {
    color: var(--text-primary);
}

/* install.php uses its own inline styles — handle separately */
.install-pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.install-pw-wrap input {
    width: 100%;
    padding-right: 50px !important;
}

.install-pw-toggle {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.install-pw-toggle:hover {
    color: #fff;
}
