/* ============================================================
   Mada Forum Theme — Unified Professional Design
   Based on ForumMap.aspx Identity
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ===== CSS Variables ===== */
:root {
  --primary: #1e3c72;
  --primary-dark: #142850;
  --navy-deep: #0d1b3e;
  --secondary: #4f9ab8;
  --accent-gold: #ffd700;
  --accent-gold-dark: #e6c200;
  --accent-green: #4ade80;
  --accent-blue: #7fb8d4;
  --accent-red: #ef4444;
  --accent-orange: #f97316;

  --bg-page: linear-gradient(180deg, #f0f9ff 0%, #ffffff 30%, #f8fafc 100%);
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --bg-muted: #f1f5f9;
  --bg-hover: #f8fafc;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-light: rgba(30, 60, 114, 0.08);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.06);
  --shadow-xl: 0 12px 35px rgba(0,0,0,0.08);
  --shadow-glow: 0 4px 15px rgba(30, 60, 114, 0.3);

  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  --font-ar: 'Tajawal', 'Segoe UI', sans-serif;
  --font-en: 'Inter', 'Segoe UI', sans-serif;

  --transition: all 0.3s ease;
  --transition-slow: all 0.4s ease;
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

/* Soft Background Pattern */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(30,60,114,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(79,154,184,0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(255,215,0,0.03) 0%, transparent 50%);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-ar); font-weight: 700; color: var(--text-primary); }

/* ===== Buttons ===== */
.mada-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-md);
  font-family: var(--font-ar); font-size: 0.9rem; font-weight: 600;
  border: 1px solid var(--border-color); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer; text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.mada-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--text-primary); border-color: #cbd5e1;
}

.mada-btn-primary {
  background: linear-gradient(135deg, #1e3c72, #142850);
  border: 1px solid rgba(255, 215, 0, 0.45);
  color: #ffd700;
  box-shadow: 0 4px 15px rgba(20, 40, 80, 0.35);
}
.mada-btn-primary:hover {
  background: linear-gradient(135deg, #142850, #0d1b3e);
  box-shadow: 0 6px 25px rgba(20, 40, 80, 0.5);
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffe14d; transform: translateY(-2px);
}

/* Gold CTA button — للدعوات الرئيسية */
.mada-btn-gold {
  background: linear-gradient(180deg, #ffe14d, #ffd700);
  border: 1px solid var(--accent-gold-dark);
  color: #1e3c72; font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}
.mada-btn-gold:hover {
  background: linear-gradient(180deg, #ffd700, #e6c200);
  color: #142850;
  box-shadow: 0 6px 25px rgba(255, 215, 0, 0.45);
  transform: translateY(-2px);
}

.mada-btn-ghost {
  background: transparent; border-color: var(--border-color);
}
.mada-btn-ghost:hover { background: var(--bg-muted); }

.mada-btn-large { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }

.mada-btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ===== Header ===== */
.mada-header {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  padding: 0;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.04);
}

.mada-header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 12px 30px;
  display: flex; align-items: center; justify-content: space-between;
}

.mada-logo {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
}

.mada-logo-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.3rem;
  box-shadow: var(--shadow-glow);
}

.mada-logo-text {
  font-family: var(--font-ar); font-weight: 800; font-size: 1.1rem;
  color: var(--text-primary);
}

.mada-nav {
  display: flex; align-items: center; gap: 28px;
}

.mada-nav a {
  font-family: var(--font-ar); font-size: 0.9rem; font-weight: 600;
  color: var(--text-secondary); text-decoration: none;
  padding: 8px 0; position: relative; transition: var(--transition);
}

.mada-nav a::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px; transform: scaleX(0); transition: transform 0.3s ease;
}

.mada-nav a:hover { color: var(--primary); }
.mada-nav a:hover::after { transform: scaleX(1); }

.mada-header-actions {
  display: flex; align-items: center; gap: 12px;
}

/* Language Switcher */
.mada-lang-switcher { position: relative; }

.mada-lang-select {
  padding: 8px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color); background: var(--bg-card);
  font-family: var(--font-ar); font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  min-width: 120px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center;
  padding-left: 32px;
  transition: var(--transition);
}

.mada-lang-select:hover, .mada-lang-select:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(30,60,114,0.1);
}

/* ===== Footer ===== */
.mada-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 40px 30px 30px;
  margin-top: 60px;
}

.mada-footer-inner {
  max-width: 1200px; margin: 0 auto;
  text-align: center;
}

.mada-footer-links {
  display: flex; justify-content: center; gap: 28px;
  margin-bottom: 20px; flex-wrap: wrap;
}

.mada-footer-links a {
  font-family: var(--font-ar); font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: var(--transition);
}

.mada-footer-links a:hover { color: var(--primary); }

.mada-footer-copy {
  font-size: 0.8rem; color: var(--text-muted);
}

/* ===== Page Container ===== */
.mada-container {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px; position: relative; z-index: 1;
}

/* ===== Hero Section ===== */
.mada-hero {
  padding: 80px 0 60px; text-align: center; position: relative;
}

.mada-hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 30px;
  background: linear-gradient(135deg, rgba(30,60,114,0.1), rgba(79,154,184,0.1));
  border: 1px solid rgba(30,60,114,0.15);
  color: var(--primary); font-size: 0.85rem; font-weight: 600;
  margin-bottom: 24px;
}

.mada-hero-title {
  font-size: 2.5rem; font-weight: 900; color: var(--text-primary);
  margin-bottom: 16px; line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mada-hero-desc {
  font-size: 1.1rem; color: var(--text-secondary);
  max-width: 600px; margin: 0 auto 32px; line-height: 1.8;
}

.mada-hero-actions {
  display: flex; justify-content: center; gap: 14px;
  margin-bottom: 50px;
}

.mada-hero-stats {
  display: flex; justify-content: center; gap: 40px;
  flex-wrap: wrap;
}

.mada-stat-item { text-align: center; }

.mada-stat-num {
  font-size: 2.4rem; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mada-stat-label {
  font-size: 0.85rem; color: var(--text-secondary); font-weight: 500;
}

/* ===== Sections ===== */
.mada-section {
  padding: 60px 0; position: relative; z-index: 1;
}

.mada-section-title {
  font-size: 2rem; font-weight: 800; text-align: center;
  margin-bottom: 12px;
}

.mada-section-subtitle {
  font-size: 1rem; color: var(--text-secondary);
  text-align: center; max-width: 600px; margin: 0 auto 40px;
}

/* ===== Cards ===== */
.mada-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: var(--transition-slow);
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}

.mada-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0; transition: opacity 0.3s;
}

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

.mada-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: #cbd5e1;
}

/* ===== Feature Cards ===== */
.mada-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.mada-feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: var(--transition-slow);
  box-shadow: var(--shadow-md);
}

.mada-feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.mada-feature-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 1.5rem;
}

.mada-feature-card h3 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 8px;
}

.mada-feature-card p {
  font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6;
}

/* ===== Audience Cards ===== */
.mada-audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.mada-audience-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: var(--transition-slow);
  box-shadow: var(--shadow-md);
}

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

.mada-audience-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.4rem;
}

.mada-audience-card h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 4px;
}

.mada-audience-card p {
  font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5;
}

/* ===== About Section ===== */
.mada-about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px; align-items: start;
}

.mada-about-text p {
  font-size: 1rem; color: var(--text-secondary);
  line-height: 1.8; margin-bottom: 16px;
}

.mada-about-highlight {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-xl);
  padding: 28px;
}

.mada-about-highlight h3 {
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; color: var(--primary-dark);
}

.mada-about-highlight ul { list-style: none; }

.mada-about-highlight li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 0.9rem; color: var(--text-secondary);
  border-bottom: 1px solid rgba(30,60,114,0.1);
}

.mada-about-highlight li:last-child { border-bottom: none; }

.mada-about-highlight li svg { color: var(--accent-green); flex-shrink: 0; }

/* ===== Auth Section ===== */
.mada-auth-tabs {
  display: flex; justify-content: center; gap: 0;
  margin-bottom: 24px;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  padding: 4px;
  max-width: 400px; margin-left: auto; margin-right: auto;
}

.mada-auth-tab {
  flex: 1; padding: 10px 24px; border-radius: var(--radius-md);
  border: none; background: transparent;
  font-family: var(--font-ar); font-size: 0.9rem; font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition);
}

.mada-auth-tab-active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.mada-auth-form {
  max-width: 420px; margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  display: none;
}

.mada-auth-form-active { display: block; }

.mada-form-group { margin-bottom: 20px; }

.mada-form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}

.mada-form-input {
  width: 100%; padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: var(--font-ar); font-size: 0.95rem;
  color: var(--text-primary); background: var(--bg-card);
  transition: var(--transition);
}

.mada-form-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,60,114,0.1);
}

.mada-form-submit {
  width: 100%; padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 215, 0, 0.45);
  background: linear-gradient(135deg, #1e3c72, #142850);
  color: #ffd700; font-family: var(--font-ar);
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 15px rgba(20, 40, 80, 0.35);
}

.mada-form-submit:hover {
  background: linear-gradient(135deg, #142850, #0d1b3e);
  box-shadow: 0 6px 25px rgba(20, 40, 80, 0.5);
  color: #ffe14d;
  transform: translateY(-1px);
}

.mada-form-alt {
  text-align: center; margin-top: 16px;
  font-size: 0.85rem; color: var(--text-secondary);
}

.mada-form-alt a {
  color: var(--primary); text-decoration: none; font-weight: 600;
}

/* ===== CTA Section ===== */
.mada-cta {
  background: linear-gradient(135deg, rgba(30,60,114,0.05), rgba(79,154,184,0.05));
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 80px 0; text-align: center;
}

.mada-cta h2 {
  font-size: 2rem; font-weight: 800; margin-bottom: 12px;
}

.mada-cta p {
  font-size: 1rem; color: var(--text-secondary);
  max-width: 500px; margin: 0 auto 28px;
}

/* ===== Dashboard ===== */
.mada-dashboard {
  padding: 40px 24px; max-width: 1100px; margin: 0 auto;
  position: relative; z-index: 1;
}

.mada-dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.mada-dash-welcome h1 {
  font-size: 1.8rem; font-weight: 800; margin: 0 0 6px;
  background: linear-gradient(135deg, var(--text-primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mada-dash-welcome p { font-size: 0.95rem; color: var(--text-secondary); margin: 0; }

.mada-dash-actions { display: flex; gap: 10px; }

.mada-dash-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin-bottom: 40px;
}

.mada-dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: var(--transition-slow);
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}

.mada-dash-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  opacity: 0.6;
}

.mada-dash-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.mada-dash-card-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 1.5rem;
}

.mada-dash-card.blue .mada-dash-card-icon { background: linear-gradient(135deg, #dbeafe, #eff6ff); color: var(--primary); }
.mada-dash-card.blue::after { background: linear-gradient(90deg, var(--primary), var(--accent-blue)); }

.mada-dash-card.green .mada-dash-card-icon { background: linear-gradient(135deg, #dcfce7, #f0fdf4); color: #16a34a; }
.mada-dash-card.green::after { background: linear-gradient(90deg, #22c55e, #4ade80); }

.mada-dash-card.orange .mada-dash-card-icon { background: linear-gradient(135deg, #fef3c7, #fffbeb); color: #d97706; }
.mada-dash-card.orange::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.mada-dash-card h3 {
  font-size: 0.9rem; font-weight: 600; margin: 0 0 6px;
  color: var(--text-secondary);
}

.mada-dash-value {
  font-size: 2.2rem; font-weight: 900; color: var(--text-primary);
  margin: 0;
}

.mada-dash-section { margin-bottom: 40px; }

.mada-dash-section h2 {
  font-size: 1.3rem; font-weight: 700; margin: 0 0 16px;
  display: flex; align-items: center; gap: 10px;
}

.mada-dash-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.mada-dash-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: background 0.2s;
}

.mada-dash-list-item:last-child { border-bottom: none; }

.mada-dash-list-item:hover { background: var(--bg-hover); }

.mada-dash-list-item-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }

.mada-dash-list-item-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.mada-dash-lang {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.mada-dash-lang h3 {
  font-size: 1.1rem; font-weight: 700; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}

.mada-dash-lang select {
  padding: 10px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: var(--font-ar); font-size: 0.9rem;
  min-width: 220px; background: var(--bg-card);
  color: var(--text-primary); cursor: pointer;
  transition: var(--transition);
}

.mada-dash-lang select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,60,114,0.1);
}

/* ===== Admin Panels ===== */
.mada-admin {
  padding: 40px 24px; max-width: 1200px; margin: 0 auto;
  position: relative; z-index: 1;
}

.mada-admin-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.mada-admin-header h1 {
  font-size: 1.6rem; font-weight: 800; margin: 0;
  background: linear-gradient(135deg, var(--text-primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mada-admin-filters {
  display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.mada-admin-filters label {
  font-size: 0.8rem; color: var(--text-secondary);
  display: block; margin-bottom: 6px; font-weight: 600;
}

.mada-admin-filters select,
.mada-admin-filters input {
  padding: 10px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: var(--font-ar); font-size: 0.9rem;
  min-width: 160px; background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition);
}

.mada-admin-filters select:focus,
.mada-admin-filters input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,60,114,0.1);
}

.mada-admin-grid {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.mada-admin-grid table { width: 100%; border-collapse: collapse; }

.mada-admin-grid th {
  background: var(--bg-muted);
  padding: 14px 18px; text-align: left;
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase; letter-spacing: 0.5px;
}

.mada-admin-grid td {
  padding: 14px 18px; font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top; color: var(--text-primary);
}

.mada-admin-grid tr:hover { background: var(--bg-hover); }

.mada-admin-grid .key-cell {
  font-family: 'SF Mono', monospace;
  color: var(--primary); font-size: 0.8rem; font-weight: 600;
}

.mada-admin-grid .value-cell {
  max-width: 300px; word-break: break-word;
  color: var(--text-secondary); line-height: 1.5;
}

.mada-admin-grid .lang-badge {
  display: inline-block; padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 700;
}

.mada-admin-actions { display: flex; gap: 8px; }

.mada-admin-actions .mada-btn {
  padding: 6px 14px; font-size: 0.8rem;
}

.mada-admin-pager {
  display: flex; justify-content: center; gap: 6px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.mada-admin-pager a, .mada-admin-pager span {
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: 0.85rem; text-decoration: none;
  border: 1px solid var(--border-color);
  font-family: var(--font-ar); font-weight: 600;
}

.mada-admin-pager a {
  background: var(--bg-card); color: var(--primary);
  transition: var(--transition);
}

.mada-admin-pager a:hover { background: var(--bg-hover); }

.mada-admin-pager span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; border-color: transparent;
}

/* ===== Language Cards (Admin Languages) ===== */
.mada-lang-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  margin-bottom: 28px;
}

.mada-lang-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px; text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.mada-lang-stat-card .stat-num {
  font-size: 2rem; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mada-lang-stat-card .stat-label {
  font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; font-weight: 500;
}

.mada-lang-grid { display: grid; gap: 14px; }

.mada-lang-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 22px 26px;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.mada-lang-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-xl); }

.mada-lang-card.inactive { opacity: 0.55; background: var(--bg-muted); }

.mada-lang-flag {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.mada-lang-info { flex: 1; }

.mada-lang-info h3 {
  font-size: 1.05rem; font-weight: 700; margin: 0 0 4px;
}

.mada-lang-info p {
  font-size: 0.82rem; color: var(--text-muted); margin: 0;
}

.mada-lang-meta {
  display: flex; align-items: center; gap: 20px;
  font-size: 0.85rem; color: var(--text-secondary);
}

.mada-lang-meta span { display: flex; align-items: center; gap: 6px; }

.mada-lang-actions { display: flex; gap: 8px; }

.mada-lang-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
}

.mada-lang-badge.active { background: #dcfce7; color: #15803d; }
.mada-lang-badge.inactive { background: #fee2e2; color: #b91c1c; }

/* ===== Modal ===== */
.mada-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 2000;
}

.mada-modal-overlay.active { display: flex; }

.mada-modal {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  padding: 32px; width: 90%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.mada-modal h2 {
  font-size: 1.3rem; font-weight: 800; margin: 0 0 24px;
}

.mada-modal .form-group { margin-bottom: 18px; }

.mada-modal label {
  display: block; font-size: 0.85rem;
  color: var(--text-secondary); margin-bottom: 6px; font-weight: 600;
}

.mada-modal input,
.mada-modal select,
.mada-modal textarea {
  width: 100%; padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: var(--font-ar); font-size: 0.9rem;
  color: var(--text-primary); background: var(--bg-card);
  transition: var(--transition);
}

.mada-modal input:focus,
.mada-modal select:focus,
.mada-modal textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,60,114,0.1);
}

.mada-modal textarea { min-height: 100px; resize: vertical; }

.mada-modal-actions {
  display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px;
}

/* ===== Alerts ===== */
.mada-alert {
  padding: 14px 18px; border-radius: var(--radius-md);
  margin-bottom: 20px; font-size: 0.9rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}

.mada-alert-success {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  color: #15803d; border: 1px solid #bbf7d0;
}

.mada-alert-error {
  background: linear-gradient(135deg, #fee2e2, #fef2f2);
  color: #b91c1c; border: 1px solid #fecaca;
}

.mada-alert-info {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #1e3c72; border: 1px solid #bfdbfe;
}

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

.animate-in { animation: fadeInUp 0.5s ease forwards; }
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .mada-header-inner { padding: 10px 16px; }
  .mada-nav { display: none; }
  .mada-hero-title { font-size: 2rem; }
  .mada-hero-stats { gap: 24px; }
  .mada-about-grid { grid-template-columns: 1fr; }
  .mada-dash-grid { grid-template-columns: 1fr; }
  .mada-lang-stats { grid-template-columns: repeat(2, 1fr); }
  .mada-lang-card { flex-wrap: wrap; }
  .mada-admin-filters { flex-direction: column; }
  .mada-admin-grid { overflow-x: auto; }
  .mada-footer-links { gap: 16px; }
}

/* ===== Header Layout Fix (2026-09) =====
   المشكلة: المحتوى أعرض من max-width:1200px فيتجاوز الحدود ويُقتطع من اليسار في RTL.
   الحل: عرض كامل مع هوامش داخلية، ومنع الانكماش للشعار والأزرار، وتوسيط الروابط. */
.mada-header-inner {
  max-width: none;
  padding: 12px 28px;
  gap: 18px;
}
.mada-logo, .mada-header-actions { flex-shrink: 0; }
.mada-nav {
  flex: 1 1 auto;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}
.mada-nav a { white-space: nowrap; font-size: 0.87rem; }

/* منع تداخل التنقل مع الشعار: التفاف داخلي عند الضيق + سطر ثانٍ حتى 1600px */
.mada-logo-text { font-size: 1rem; }
.mada-nav { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 1600px) and (min-width: 769px) {
  .mada-header-inner { flex-wrap: wrap; }
  .mada-nav { order: 3; flex-basis: 100%; justify-content: center; }
}

/* ============================================================
   الوضع الليلي — body.dark-mode (العقد: class على <body>)
   يعيد تعريف كل متغيرات الخلفيات/النصوص/الحدود/الظلال
   + overrides للعناصر التي لا تستخدم المتغيرات
   ============================================================ */
body.dark-mode {
  --bg-page: linear-gradient(180deg, #0a1428 0%, #0d1b3e 100%);
  --bg-card: #101f3c;
  --bg-glass: rgba(16, 31, 60, 0.92);
  --bg-muted: #16294d;
  --bg-hover: #1a3054;

  --text-primary: #e8edf7;
  --text-secondary: #9fb3d1;
  --text-muted: #6d84a8;

  --border-color: #1e3a5f;
  --border-light: rgba(79, 154, 184, 0.15);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
  --shadow-xl: 0 12px 35px rgba(0,0,0,0.45);
  --shadow-glow: 0 4px 15px rgba(0,0,0,0.4);
}

body.dark-mode::before {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(30,60,114,0.28) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(79,154,184,0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(255,215,0,0.05) 0%, transparent 50%);
}

/* --- Base --- */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 { color: var(--text-primary); }
body.dark-mode a { color: #9cc3d9; }
body.dark-mode a:hover { color: var(--accent-gold); }
body.dark-mode hr { border-color: var(--border-color); }
body.dark-mode ::placeholder { color: var(--text-muted); opacity: 1; }

/* --- Header / Footer / Nav --- */
body.dark-mode .mada-header { box-shadow: 0 2px 20px rgba(0,0,0,0.4); }
body.dark-mode .mada-nav a { color: var(--text-secondary); }
body.dark-mode .mada-nav a:hover { color: var(--accent-gold); }
body.dark-mode .mada-nav a::after { background: linear-gradient(90deg, var(--accent-gold), var(--secondary)); }
body.dark-mode .mada-footer { background: var(--bg-card); border-top-color: var(--border-color); }
body.dark-mode .mada-footer-links a:hover { color: var(--accent-gold); }

/* --- Buttons --- */
body.dark-mode .mada-btn:hover { border-color: #2d4a73; }
body.dark-mode .mada-btn-primary {
  background: linear-gradient(135deg, #2a4d8f, #1e3c72);
  border-color: rgba(255, 215, 0, 0.55);
}
body.dark-mode .mada-btn-primary:hover {
  background: linear-gradient(135deg, #1e3c72, #142850);
  border-color: rgba(255, 215, 0, 0.8);
}
body.dark-mode .mada-btn-ghost:hover { background: var(--bg-muted); }
body.dark-mode .mada-btn-gold { color: #1e3c72; border-color: var(--accent-gold-dark); }
body.dark-mode .mada-btn-gold:hover { color: #142850; }
body.dark-mode .mada-form-submit { background: linear-gradient(135deg, #2a4d8f, #1e3c72); }
body.dark-mode .mada-form-submit:hover { background: linear-gradient(135deg, #1e3c72, #142850); }

/* --- Hero --- */
body.dark-mode .mada-hero-badge {
  background: rgba(79,154,184,0.12);
  border-color: rgba(79,154,184,0.3);
  color: var(--accent-gold);
}
body.dark-mode .mada-stat-num,
body.dark-mode .mada-lang-stat-card .stat-num {
  background: linear-gradient(135deg, var(--accent-gold), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Cards --- */
body.dark-mode .mada-card::before { background: linear-gradient(90deg, var(--accent-gold), var(--secondary)); }
body.dark-mode .mada-card:hover,
body.dark-mode .mada-lang-card:hover { border-color: #2d4a73; }
body.dark-mode .mada-about-highlight {
  background: rgba(79,154,184,0.06);
  border-color: var(--border-color);
}
body.dark-mode .mada-about-highlight h3 { color: #9cc3d9; }
body.dark-mode .mada-about-highlight li { border-bottom-color: rgba(79,154,184,0.15); }
body.dark-mode .mada-cta {
  background: rgba(79,154,184,0.06);
  border-top-color: var(--border-light);
  border-bottom-color: var(--border-light);
}

/* --- Dashboard --- */
body.dark-mode .mada-dash-card.blue .mada-dash-card-icon { background: rgba(79,154,184,0.15); color: #9cc3d9; }
body.dark-mode .mada-dash-card.blue::after { background: linear-gradient(90deg, var(--secondary), var(--accent-blue)); }
body.dark-mode .mada-dash-card.green .mada-dash-card-icon { background: rgba(74,222,128,0.12); color: #4ade80; }
body.dark-mode .mada-dash-card.orange .mada-dash-card-icon { background: rgba(255,215,0,0.12); color: var(--accent-gold); }

/* --- Forms / Inputs (شاملة لعناصر الصفحات التي لا تستخدم المتغيرات) --- */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: #0d1b3e;
  color: var(--text-primary);
  border-color: var(--border-color);
}
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(79,154,184,0.18);
  outline: none;
}
body.dark-mode select option { background-color: #101f3c; color: #e8edf7; }
body.dark-mode .mada-auth-tab-active { color: var(--accent-gold); }
body.dark-mode .mada-form-alt a { color: #9cc3d9; }

/* --- Tables (جداول الصفحات وشبكات الإدارة) --- */
body.dark-mode table { color: var(--text-primary); }
body.dark-mode table th, body.dark-mode table td { border-color: var(--border-color); }
body.dark-mode .mada-admin-grid .key-cell { color: #9cc3d9; }
body.dark-mode .mada-admin-pager a { color: #9cc3d9; }
body.dark-mode .mada-admin-pager span { background: linear-gradient(135deg, #2a4d8f, #1e3c72); color: var(--accent-gold); }

/* --- Language badges --- */
body.dark-mode .mada-lang-badge.active { background: rgba(34,197,94,0.15); color: #4ade80; }
body.dark-mode .mada-lang-badge.inactive { background: rgba(239,68,68,0.15); color: #f87171; }
body.dark-mode .mada-lang-card.inactive { background: var(--bg-muted); }

/* --- Alerts --- */
body.dark-mode .mada-alert-success {
  background: rgba(34,197,94,0.12); color: #4ade80;
  border-color: rgba(74,222,128,0.25);
}
body.dark-mode .mada-alert-error {
  background: rgba(239,68,68,0.12); color: #f87171;
  border-color: rgba(248,113,113,0.25);
}
body.dark-mode .mada-alert-info {
  background: rgba(79,154,184,0.12); color: #9cc3d9;
  border-color: rgba(79,154,184,0.3);
}

/* --- Modals & Dropdowns --- */
body.dark-mode .mada-modal-overlay { background: rgba(4, 10, 24, 0.65); }
body.dark-mode .modal-content,
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}
body.dark-mode .dropdown-menu {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}
body.dark-mode .dropdown-item { color: var(--text-secondary); }
body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus { background: var(--bg-hover); color: var(--text-primary); }

/* --- Chat quick menu (أنماطه الأصلية في الماستر بألوان فاتحة ثابتة) --- */
body.dark-mode .chat-quick-menu {
  background: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  color: var(--text-primary);
}
body.dark-mode .chat-quick-header { border-bottom-color: var(--border-color); color: var(--text-primary); }
body.dark-mode .chat-quick-header a { color: #9cc3d9; }
body.dark-mode .chat-quick-item { border-bottom-color: var(--border-color); color: var(--text-primary); }
body.dark-mode .chat-quick-item:hover { background: var(--bg-hover); }
body.dark-mode .chat-quick-item img { background: #1e3a5f; }
body.dark-mode .chat-quick-footer { border-top-color: var(--border-color); }
body.dark-mode .chat-quick-footer a { color: #9cc3d9; }

/* --- Header extras (أيقونة الشات في الماستر) --- */
body.dark-mode .master-chat-icon { background: rgba(79,154,184,0.15); color: #9cc3d9; }
body.dark-mode .master-chat-icon:hover { background: var(--primary); color: var(--accent-gold); }
body.dark-mode .mada-dark-toggle,
body.dark-mode .mada-nav-toggle { color: var(--text-primary); }

/* ============================================================
   قائمة الجوال — drawer منزلق ≤ 992px
   العقد: .mada-nav-toggle / .mada-nav / .mada-nav.open /
   .mada-nav-backdrop(.open) / .mada-nav-close
   ملاحظة: نستخدم button./div. لرفع الـspecificity فوق قواعد الماستر المضمّنة
   ============================================================ */

/* --- Base: مخفي على الشاشات الكبيرة --- */
button.mada-nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: var(--transition);
}
button.mada-nav-toggle:hover { background: var(--bg-muted); color: var(--primary); }

button.mada-nav-close {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  color: #dbe6f5;
  position: absolute; top: 14px; inset-inline-end: 14px;
  transition: var(--transition);
}
button.mada-nav-close:hover { background: rgba(255,255,255,0.1); color: var(--accent-gold); }

div.mada-nav-backdrop {
  display: block;
  position: fixed; inset: 0;
  background: rgba(10, 20, 40, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1090;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
div.mada-nav-backdrop.open { opacity: 1; visibility: visible; }

/* --- Drawer ≤ 992px --- */
@media (max-width: 992px) {
  button.mada-nav-toggle { display: flex; }
  button.mada-nav-close { display: flex; }

  /* الهيدر يبقى flex سليمًا: الشعار ثم الأزرار ثم الهامبرغر */
  .mada-header-inner {
    flex-wrap: nowrap;
    padding: 10px 16px;
    gap: 10px;
    justify-content: flex-start;
  }
  .mada-logo { flex-shrink: 0; min-width: 0; }
  .mada-logo-text {
    font-size: 0.95rem;
    max-width: 40vw; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .mada-header-actions {
    flex-wrap: nowrap; gap: 8px; flex-shrink: 0;
    margin-inline-start: auto;
    order: 2;
  }
  button.mada-nav-toggle { order: 3; flex-shrink: 0; }

  /* القائمة تتحول إلى drawer ثابت */
  .mada-nav {
    position: fixed; top: 0;
    height: 100vh; height: 100dvh;
    width: min(320px, 85vw);
    background: linear-gradient(180deg, #1e3c72 0%, #142850 60%, #0d1b3e 100%);
    display: flex; flex-direction: column; align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap; gap: 2px;
    padding: 64px 20px 24px;
    overflow-y: auto;
    z-index: 1100;
    box-shadow: 0 0 40px rgba(0,0,0,0.35);
    transition: transform 0.35s ease;
  }

  /* الاتجاه: يمين في RTL، يسار في LTR (الـclass على form) */
  .mada-rtl .mada-nav { right: 0; left: auto; transform: translateX(100%); }
  .mada-ltr .mada-nav { left: 0; right: auto; transform: translateX(-100%); }
  .mada-nav.open { transform: translateX(0); }

  /* روابط الـdrawer */
  .mada-nav a {
    color: #dbe6f5; font-size: 1rem;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    white-space: normal;
    display: flex; align-items: center; gap: 10px;
  }
  .mada-nav a:hover { color: var(--accent-gold); background: rgba(255,255,255,0.06); }
  .mada-nav a::after { display: none; }
  .mada-nav a i { color: var(--secondary); font-size: 1.05rem; }
  .mada-nav a:hover i { color: var(--accent-gold); }
}

/* drawer في الوضع الليلي: كحلي أعمق */
@media (max-width: 992px) {
  body.dark-mode .mada-nav {
    background: linear-gradient(180deg, #101f3c 0%, #0d1b3e 100%);
  }
}
