/* =============================================
   Al-Furqan Learning Platform — Design System
   Modern, clean, professional theme
   ============================================= */

/* CSS Variables */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-hover: #f0f2f8;
  --surface-active: #e8ecf4;
  --text: #0b1a33;
  --text-secondary: #4a5a72;
  --text-muted: #7e8b9f;
  --primary: #4154f1;
  --primary-light: #eef1ff;
  --primary-hover: #3143cc;
  --primary-soft: #eef1ff;
  --primary-gradient: linear-gradient(135deg, #4154f1, #6c3bd6);
  --danger: #e53e3e;
  --danger-light: #fee8e8;
  --danger-hover: #c53030;
  --success: #0dbb7a;
  --success-light: #e1faf0;
  --success-hover: #069e67;
  --warning: #f59e0b;
  --warning-light: #fef7e0;
  --warning-hover: #d97706;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --header-bg: rgba(255,255,255,0.92);
  --header-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 8px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1), 0 8px 16px -6px rgba(0,0,0,0.06);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-card-hover: 0 12px 30px -8px rgba(0,0,0,0.12), 0 4px 8px -4px rgba(0,0,0,0.06);
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus-ring: rgba(65, 84, 241, 0.18);
  --table-hover: #f0f2f8;
  --table-header: #f8f9fc;
  --table-stripe: #fafbfe;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-arabic: 'Segoe UI', 'Traditional Arabic', 'Tahoma', sans-serif;
  --header-height: 64px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #0d0e1a;
  --surface: #15162b;
  --surface-hover: #1d1e38;
  --surface-active: #25274a;
  --text: #e2e4f0;
  --text-secondary: #989bb8;
  --text-muted: #6b6e8f;
  --primary: #6c83ff;
  --primary-light: #1c1f42;
  --primary-hover: #5a70e8;
  --primary-soft: #1c1f42;
  --primary-gradient: linear-gradient(135deg, #6c83ff, #8b6cff);
  --danger: #fc5a5a;
  --danger-light: #2e1818;
  --danger-hover: #e04848;
  --success: #34d399;
  --success-light: #162b22;
  --success-hover: #10b981;
  --warning: #fbbf24;
  --warning-light: #2e2818;
  --warning-hover: #f59e0b;
  --info: #60a5fa;
  --info-light: #182436;
  --secondary: #6b7280;
  --secondary-hover: #4b5563;
  --border: #25274a;
  --border-light: #1d1e38;
  --header-bg: rgba(15,16,30,0.95);
  --header-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.4), 0 4px 8px -4px rgba(0,0,0,0.2);
  --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.5), 0 8px 16px -6px rgba(0,0,0,0.3);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 12px 30px -8px rgba(0,0,0,0.5), 0 4px 8px -4px rgba(0,0,0,0.3);
  --input-bg: #1d1e38;
  --input-border: #25274a;
  --input-focus-ring: rgba(108, 131, 255, 0.25);
  --table-hover: #1d1e38;
  --table-header: #181930;
  --table-stripe: #181930;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  padding-top: var(--header-height);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL Support */
[dir="rtl"] body {
  font-family: var(--font-arabic);
  line-height: 1.8;
}

[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .container,
[dir="rtl"] header nav {
  text-align: right;
}

[dir="rtl"] header ul {
  padding-right: 0;
}

[dir="rtl"] .form-check {
  padding-right: 0;
}

[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
  text-align: right;
}

[dir="rtl"] .form-check-input {
  margin-right: 0;
  margin-left: 10px;
}

[dir="rtl"] .pagination {
  flex-direction: row;
}

[dir="rtl"] form.inline-form {
  margin-left: 0;
  margin-right: 5px;
}

[dir="rtl"] header ul li a.logout {
  margin-right: 0;
}

[dir="rtl"] .header-controls {
  flex-direction: row;
}

[dir="rtl"] .badge {
  margin-right: 0;
  margin-left: 8px;
}

[dir="rtl"] .card-actions {
  text-align: left;
}

[dir="rtl"] .btn-small svg,
[dir="rtl"] .btn svg {
  margin-left: 0;
  margin-right: 6px;
}

[dir="rtl"] .dropdown-menu {
  left: auto;
  right: 0;
}

[dir="rtl"] .nav-links {
  margin-right: 0;
}

[dir="rtl"] .stat-card::before {
  left: 0;
  right: 0;
}

[dir="rtl"] .user-badge {
  margin-left: 0;
  margin-right: 10px;
}

[dir="rtl"] .hero {
  margin-right: calc(-50vw + 50%);
  margin-left: auto;
}

[dir="rtl"] .hero-content {
  text-align: center;
}

[dir="rtl"] .news-item-body h2 {
  text-align: right;
}

[dir="rtl"] .news-item-body h2::after {
  left: 50%;
  right: auto;
}

[dir="rtl"] .about-card {
  text-align: right;
}

[dir="rtl"] .filter-bar select,
[dir="rtl"] .filter-bar input {
  background-position: left 12px center;
  padding-right: 14px;
  padding-left: 36px;
}

[dir="rtl"] .progress-bar-fill {
  margin-right: 0;
}

[dir="rtl"] main.container {
  text-align: right;
}

[dir="rtl"] .flex-between {
  flex-direction: row;
}

[dir="rtl"] .data-table th:first-child,
[dir="rtl"] .data-table td:first-child {
  text-align: right;
}

[dir="rtl"] .feature-card h3 {
  text-align: center;
}

[dir="rtl"] .team-card {
  text-align: center;
}

[dir="rtl"] .item-list li {
  text-align: right;
}

[dir="rtl"] .item-list li > div:last-child {
  justify-content: flex-start;
}

[dir="rtl"] .pagination a:first-child {
  margin-left: 0;
}

[dir="rtl"] .scroll-top {
  right: auto;
  left: 30px;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ========== MAIN LAYOUT ========== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: calc(100vh - var(--header-height) - 200px);
  animation: fadeInUp 0.4s ease;
}

main.container {
  max-width: 1200px;
  width: 100%;
  padding: var(--spacing-xl);
  margin: var(--spacing-lg) auto 50px;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== HEADER ========== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--header-shadow);
  z-index: 1000;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  border-bottom: 1px solid var(--border-light);
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: var(--spacing-md);
  flex-wrap: nowrap;
  width: 100%;
}

header .logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

header ul {
  display: flex;
  list-style: none;
  gap: 2px;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

header ul::-webkit-scrollbar {
  display: none;
}

header ul li a {
  display: block;
  padding: 8px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
}

header ul li a:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

header ul li a.logout {
  background: var(--danger);
  color: white;
  border-radius: var(--radius-sm);
}

header ul li a.logout:hover {
  background: var(--danger-hover);
}

header ul li a.logout::after {
  display: none;
}

/* Theme & Lang Toggle */
.theme-toggle, .lang-toggle {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.theme-toggle:hover, .lang-toggle:hover {
  background: var(--surface-active);
  border-color: var(--primary);
  color: var(--primary);
}

.lang-toggle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
}

/* Nav toggle for mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.nav-toggle:hover {
  background: var(--surface-hover);
}

/* User badge & logout */
.user-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 8px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: inline-block;
  padding: 6px 16px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  background: var(--danger);
  color: white !important;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-logout:hover {
  background: var(--danger-hover);
  color: white !important;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229,62,62,0.3);
}

/* ========== PAGE TITLES ========== */
h2 {
  text-align: center;
  color: var(--text);
  margin-bottom: var(--spacing-lg);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  position: relative;
  padding-bottom: 14px;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

h3 {
  color: var(--text);
  margin: var(--spacing-xl) 0 var(--spacing-md);
  font-size: 1.2rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

h4 {
  color: var(--text);
  font-weight: 600;
}

p {
  color: var(--text-muted);
  line-height: 1.8;
}

/* ========== BUTTONS ========== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
}

button::after, .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

button:hover, .btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

button:hover::after, .btn:hover::after {
  opacity: 1;
}

button:active, .btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(65, 84, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(65, 84, 241, 0.4);
  color: white;
  transform: translateY(-2px);
}

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

.btn-secondary:hover {
  background: var(--secondary-hover);
  box-shadow: 0 4px 12px rgba(100,116,139,0.3);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 4px 14px rgba(13,187,122,0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(13,187,122,0.4);
  color: white;
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  box-shadow: 0 4px 14px rgba(229,62,62,0.3);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(229,62,62,0.4);
  color: white;
  transform: translateY(-2px);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), var(--warning-hover));
  color: #1a1a1a;
  box-shadow: 0 4px 14px rgba(245,158,11,0.3);
}

.btn-warning:hover {
  box-shadow: 0 6px 20px rgba(245,158,11,0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(65,84,241,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: none;
}

/* Button sizes */
.btn-sm, .btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 35px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: 16px 42px;
  font-size: 1.15rem;
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
}

/* ========== LINKS ========== */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ========== FLASH MESSAGES ========== */
.flash-messages {
  margin-bottom: var(--spacing-lg);
}

.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
  line-height: 1.5;
}

.alert-success {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert-danger {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.alert-info {
  background-color: var(--info-light);
  color: var(--info);
  border: 1px solid var(--info);
}

.alert-warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.2px;
}

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text);
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 4px var(--input-focus-ring);
  outline: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

[dir="rtl"] select {
  background-position: left 12px center;
  padding-right: 14px;
  padding-left: 36px;
}

input[type="file"] {
  padding: 10px;
  border-style: dashed;
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--primary);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.form-check {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.form-check:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.form-check-label {
  cursor: pointer;
  font-size: 15px;
  flex: 1;
}

/* Form validation */
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(229,62,62,0.12);
}

.text-danger {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 4px;
  display: block;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.85em;
}

.text-success {
  color: var(--success);
}

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

/* ========== TABLES ========== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--spacing-md);
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.data-table th {
  background-color: var(--table-header);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
  background-color: var(--table-stripe);
}

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

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--table-hover);
}

/* ========== ITEM LIST (CARD LIST) ========== */
.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.item-list li {
  background-color: var(--surface);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-md);
  transition: all 0.25s ease;
  position: relative;
}

.item-list li:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.item-list li strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--text);
}

.item-list li p {
  margin-bottom: 6px;
  font-size: 13px;
}

.item-list li .btn-small {
  margin: 2px;
}

.item-list li > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ========== BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--badge-bg, var(--primary-soft));
  color: var(--badge-text, var(--primary));
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-secondary {
  background: var(--surface-active);
  color: var(--text-secondary);
}

/* ========== CARD GRID ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-card);
}

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

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

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text);
}

.card-text {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: var(--spacing-md);
}

.card-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

/* ========== QUESTION / TASK BLOCKS ========== */
.question-block, .task-block {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-lg);
  background-color: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-block:hover, .task-block:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
}

.question-block h4, .task-block h4 {
  margin-bottom: var(--spacing-md);
  font-size: 1rem;
}

.question-result-block, .task-result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.question-result-block:hover, .task-result-block:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-card-hover);
}

.question-result-block h4, .task-result-block h4 {
  margin-bottom: var(--spacing-md);
}

.question-result-block p, .task-result-block p {
  margin-bottom: 8px;
}

/* ========== DASHBOARD ========== */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--surface);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

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

.stat-card h3 {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--spacing-sm);
  border: none;
  padding-bottom: 0;
  font-weight: 600;
}

.stat-card p {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
}

/* Dashboard Actions Grid */
.dashboard-actions ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
}

.dashboard-actions li {
  margin-bottom: 0;
}

.dashboard-actions li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-card);
}

.dashboard-actions li a:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* Subject tabs */
.subject-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.subject-tabs .btn {
  padding: 8px 18px;
  font-size: 13px;
}

/* Progress bar */
.progress-bar-wrap {
  margin: 15px 0;
  padding: 15px 20px;
  background: var(--surface-hover);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.progress-bar-wrap strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}

.progress-bar {
  background: var(--border);
  border-radius: 10px;
  height: 22px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  background: var(--primary-gradient);
  border-radius: 10px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  transition: width 0.6s ease;
  min-width: 30px;
}

/* ========== PAGINATION ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md);
}

.pagination a {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
}

.pagination a:hover {
  background: var(--primary-hover);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(65,84,241,0.3);
}

.pagination span {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ========== INLINE FORMS ========== */
.inline-form {
  display: inline-block;
  margin-left: 5px;
}

[dir="rtl"] .inline-form {
  margin-left: 0;
  margin-right: 5px;
}

/* ========== FOOTER ========== */
footer {
  background: var(--text);
  color: rgba(255,255,255,0.9);
  padding: 0;
  margin-top: 0;
  border-top: none;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

.footer-section h4 {
  color: white;
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: none;
}

.footer-section p,
.footer-section li {
  color: rgba(255,255,255,0.65);
  line-height: 1.8;
  font-size: 0.9rem;
  white-space: pre-line;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-section ul li a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section ul li a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
}

/* ========== SECTION HEADER ========== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

/* ========== FILTER BAR ========== */
.filter-bar {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--surface-hover);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.filter-bar label {
  margin-bottom: 0;
  white-space: nowrap;
  font-weight: 600;
}

.filter-bar select,
.filter-bar input {
  width: auto;
  min-width: 200px;
}

/* ========== SCROLL TO TOP ========== */
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(65,84,241,0.3);
  transition: all 0.2s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 999;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(65,84,241,0.4);
}

/* ========== COUNTDOWN ========== */
#countdown {
  font-weight: 700;
  color: var(--danger);
  font-size: 1.3rem;
  padding: 8px 16px;
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  display: inline-block;
  letter-spacing: 1px;
}

.time-warning {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: var(--spacing-lg);
  animation: pulse 1.5s ease infinite;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: var(--spacing-lg);
  color: var(--text-muted);
}

/* ========== LESSONS ========== */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-lg);
}

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-card);
}

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

.lesson-card a {
  text-decoration: none;
  color: inherit;
}

.lesson-thumb {
  position: relative;
  padding-bottom: 56.25%;
  background: var(--surface-active);
}

.lesson-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}

.lesson-card:hover .play-overlay {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--primary);
  box-shadow: 0 0 30px rgba(65,84,241,0.4);
}

.play-overlay span {
  color: white;
  font-size: 24px;
}

.lesson-info {
  padding: var(--spacing-md) var(--spacing-lg);
}

.lesson-info h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.lesson-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.lesson-desc {
  margin: var(--spacing-sm) 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Lesson detail video */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Comments */
.comment {
  padding: var(--spacing-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  background: var(--surface-hover);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  font-size: 14px;
}

.comment-author {
  font-weight: 600;
  color: var(--primary);
}

.comment-date {
  color: var(--text-secondary);
  font-size: 12px;
}

.comment-content {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

/* ========== USER PROFILE ========== */
.user-profile {
  max-width: 600px;
  margin: 0 auto;
}

/* ========== SPINNER ========== */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========== FLEX UTILITIES ========== */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.flex-gap {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

/* =============================================
   PLATFORM LANDING PAGE STYLES
   ============================================= */

/* === Hero === */
.hero {
  background: linear-gradient(135deg, #4154f1 0%, #6c3bd6 45%, #8b2fc9 100%);
  color: white;
  text-align: center;
  padding: 120px 24px;
  position: relative;
  overflow: hidden;
  margin: calc(-1 * var(--spacing-lg)) auto 0;
  max-width: 100vw;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255,255,255,0.04) 0%, transparent 50%);
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.25;
  text-shadow: 0 2px 15px rgba(0,0,0,0.15);
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 35px;
  opacity: 0.92;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-buttons .btn {
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 700;
}

.hero-welcome {
  font-size: 1.3rem;
  margin-bottom: 20px;
  opacity: 0.95;
}

.btn-outline-light {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.8);
  color: white;
  backdrop-filter: blur(4px);
}

.btn-outline-light:hover {
  background: white;
  color: var(--primary);
  border-color: white;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* === Section Title === */
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 50px;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
  margin: 16px auto 0;
}

/* === Features Section === */
.features-section {
  padding: 80px 0;
  background: var(--surface);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

.feature-card {
  text-align: center;
  padding: 44px 28px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}

.feature-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 1.15rem;
  border: none;
  padding: 0;
}

.feature-card p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

/* === News Section === */
.news-section {
  padding: 80px 0;
  background: var(--bg);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  margin-top: 50px;
}

.news-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  border: 1px solid var(--border-light);
}

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

.news-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.news-card:hover .news-card-img {
  transform: scale(1.03);
}

.news-card-body {
  padding: 22px;
}

.news-card-body h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
  border: none;
  padding: 0;
}

.news-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.news-card-body .btn-small {
  margin-top: 8px;
}

/* === News Listing === */
.news-list {
  max-width: 800px;
  margin: 0 auto;
}

.news-item {
  display: flex;
  gap: 24px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-card);
}

.news-item:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.news-item-img {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.news-item-body h2 {
  font-size: 1.3rem;
  margin-bottom: 5px;
  text-align: left;
  padding-bottom: 0;
}

.news-item-body h2::after {
  display: none;
}

.news-item-body h2 a {
  color: var(--text);
  text-decoration: none;
}

.news-item-body h2 a:hover {
  color: var(--primary);
}

/* === News Detail === */
.news-detail {
  max-width: 800px;
  margin: 0 auto;
}

.news-detail h1 {
  font-size: 2rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.news-detail-img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 20px 0;
  box-shadow: var(--shadow-md);
}

.rich-content {
  line-height: 1.9;
  font-size: 1.05rem;
  color: var(--text);
}

.rich-content p {
  margin-bottom: 15px;
}

/* === Team Section === */
.team-section {
  padding: 80px 0;
  background: var(--surface);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
  margin-top: 50px;
}

.team-grid-full {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.team-card {
  text-align: center;
  padding: 36px 24px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.team-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.team-card:hover::before {
  opacity: 1;
}

.team-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}

.team-card-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 15px;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow-md);
}

.team-card-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  box-shadow: var(--shadow-md);
}

.team-card-avatar-lg {
  width: 140px;
  height: 140px;
  font-size: 3rem;
}

.team-card h3 {
  margin-bottom: 5px;
  font-size: 1.1rem;
  border: none;
  padding: 0;
  margin-top: 0;
}

.team-position {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.team-bio {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* === About Page === */
.about-section {
  margin-bottom: 40px;
}

.about-section h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin: 30px 0;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-card);
}

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

.about-card-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  display: block;
}

.about-card h3 {
  margin-bottom: 15px;
  color: var(--primary);
  border: none;
  padding: 0;
}

/* === Page Title === */
.page-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 30px;
  text-align: center;
}

.page-content {
  padding-top: 40px;
  padding-bottom: 40px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  body {
    padding-top: 56px;
  }

  main {
    padding: 0 12px;
  }

  main.container {
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-sm);
    box-shadow: none;
  }

  header {
    height: 56px;
    padding: 0 12px;
  }

  header nav {
    gap: var(--spacing-sm);
  }

  header .logo {
    font-size: 1.05rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  header ul {
    gap: 1px;
  }

  header ul li a {
    padding: 6px 10px;
    font-size: 12px;
  }

  .header-controls {
    gap: 4px;
  }

  .theme-toggle, .lang-toggle {
    padding: 4px 8px;
    font-size: 13px;
  }

  .user-badge {
    max-width: 80px;
    font-size: 0.72rem;
    padding: 3px 10px;
    margin: 0 4px;
  }

  .btn-logout {
    padding: 4px 12px;
    font-size: 0.75rem;
  }

  /* Mobile nav */
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    border-bottom: 2px solid var(--border);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li a {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
  }

  .nav-links li:last-child a {
    border-bottom: none;
  }

  .hero {
    padding: 80px 16px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-buttons .btn {
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .item-list li {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-md);
  }

  .item-list li > div:last-child {
    width: 100%;
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }

  .stat-card {
    padding: var(--spacing-md);
  }

  .stat-card p {
    font-size: 1.6rem;
  }

  .dashboard-actions ul {
    grid-template-columns: 1fr;
  }

  .lessons-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .btn-small {
    padding: 8px 14px;
    font-size: 13px;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.05rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: var(--spacing-md);
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
    min-width: unset;
  }

  .news-item {
    flex-direction: column;
  }

  .news-item-img {
    width: 100%;
    height: 200px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

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

  footer {
    text-align: center;
  }

  .footer-content {
    padding: 40px 16px 24px;
    gap: 30px;
  }
}

@media (max-width: 480px) {
  main.container {
    padding: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  button, .btn {
    width: 100%;
    justify-content: center;
  }

  .inline-form {
    display: block !important;
    width: 100%;
    margin-left: 0;
    margin-bottom: 8px;
  }

  [dir="rtl"] .inline-form {
    margin-right: 0;
  }

  .pagination {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero {
    padding: 60px 16px;
  }

  .section-title {
    font-size: 1.5rem;
  }
}

/* Leaderboard */
.leaderboard-section {
  padding: var(--spacing-2xl, 50px) 16px;
}
.leaderboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard-table th {
  background: var(--primary);
  color: #ffffff;
  padding: 12px 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.leaderboard-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}
.leaderboard-table tbody tr:hover {
  background: var(--table-hover);
}
.leaderboard-section .container {
  max-width: 920px;
  margin: 0 auto;
}
.rank-cell {
  font-weight: 700;
  color: var(--primary);
}
