/* ═══════════════════════════════════════════════════════════════
   main.css — المتغيرات + الـ Reset + الحاويات الرئيسية
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-light: #818cf8;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;

  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --line: #e2e8f0;
  --line-light: #f1f5f9;

  --bg: #f7f8fc;
  --bg-soft: #f8fafc;
  --panel: #ffffff;

  --radius-sm: .5rem;
  --radius: .875rem;
  --radius-lg: 1.25rem;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-card: 0 12px 24px rgba(99, 102, 241, .09);
}

* {
  box-sizing: border-box;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: linear-gradient(180deg, #f7f8fc 0%, #eef3ff 100%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code {
  background: var(--line-light);
  padding: .15rem .35rem;
  border-radius: .35rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--brand);
}

.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.fade { animation: fadeIn .35s cubic-bezier(.16, 1, .3, 1); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--line-light);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-sm {
  width: 16px; height: 16px;
  border-width: 2px;
  border-top-color: #fff;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gradient-text {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  background: transparent;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.25rem;
  background: rgba(255,255,255,.74);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.app-content {
  flex: 1;
  padding: 1.25rem;
  min-width: 0;
}

.toasts {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

@media (max-width: 479px) {
  :root {
    --radius-sm: .35rem;
    --radius: .65rem;
    --radius-lg: 1rem;
  }

  body { font-size: .85rem; }
  .app-content { padding: .8rem; }
  .app-header { padding: .75rem 1rem; }
  .toasts {
    bottom: .75rem;
    left: .75rem;
    gap: .35rem;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .app-content { padding: 1.3rem; }
  .app-main { min-height: 100vh; }
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: 18rem minmax(0, 1fr);
  }
}

@media (min-width: 1920px) {
  .app-content {
    max-width: 1900px;
    margin: 0 auto;
    width: 100%;
  }
  .app-header {
    max-width: 1900px;
    margin: 0 auto;
    width: 100%;
  }
}
