/* ==========================================================================
   HA Smart Pips Academy — Design System
   Identity: "trading terminal, quietly expensive"
   Signature motif: the pip axis — hairline ticks borrowed from a price scale.
   ========================================================================== */

:root {
  /* Surfaces — layered ink, not flat black */
  --bg-primary:   #070B11;
  --bg-secondary: #0B121B;
  --surface:      #111A25;
  --surface-2:    #16202D;
  --surface-hover:#1B2735;
  --surface-glass: rgba(17, 26, 37, .72);

  /* Text */
  --text-primary:   #EAF1F8;
  --text-secondary: #93A4B8;
  --text-muted:     #61738A;

  /* Lines */
  --border:       rgba(147, 172, 200, .14);
  --border-strong:rgba(147, 172, 200, .26);

  /* Accents */
  --accent:       #12D6A0;   /* pip green  */
  --accent-soft:  rgba(18, 214, 160, .12);
  --accent-2:     #E8B65A;   /* premium gold */
  --accent-3:     #4C8DFF;   /* terminal blue */
  --success:      #12D6A0;
  --warning:      #E8B65A;
  --danger:       #FF5C6E;
  --info:         #4C8DFF;

  --grad-accent: linear-gradient(135deg, #12D6A0 0%, #4C8DFF 100%);
  --grad-gold:   linear-gradient(135deg, #E8B65A 0%, #C98F2E 100%);
  --grad-surface:linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,0) 60%);

  /* Type */
  --font-display: 'Tajawal', 'Sora', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --step--1: clamp(.78rem, .76rem + .1vw, .84rem);
  --step-0:  clamp(.94rem, .92rem + .12vw, 1rem);
  --step-1:  clamp(1.1rem, 1.05rem + .3vw, 1.28rem);
  --step-2:  clamp(1.35rem, 1.25rem + .6vw, 1.75rem);
  --step-3:  clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --step-4:  clamp(2.2rem, 1.7rem + 2.4vw, 3.9rem);

  /* Geometry */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.28);
  --shadow:    0 12px 34px rgba(0,0,0,.38);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.5);
  --glow:      0 0 0 1px rgba(18,214,160,.28), 0 12px 40px rgba(18,214,160,.16);

  --container: 1240px;
  --header-h: 72px;
  --transition: 220ms cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg-primary:   #F6F8FB;
  --bg-secondary: #FFFFFF;
  --surface:      #FFFFFF;
  --surface-2:    #F1F5F9;
  --surface-hover:#E9EFF6;
  --surface-glass: rgba(255,255,255,.82);
  --text-primary:   #0C1622;
  --text-secondary: #4A5C71;
  --text-muted:     #7B8CA1;
  --border:       rgba(12, 22, 34, .1);
  --border-strong:rgba(12, 22, 34, .2);
  --accent:       #06A87C;
  --accent-soft:  rgba(6, 168, 124, .1);
  --accent-2:     #B37B12;
  --accent-3:     #2563EB;
  --success:      #06A87C;
  --warning:      #B37B12;
  --danger:       #D93248;
  --shadow-sm: 0 2px 8px rgba(16,32,52,.07);
  --shadow:    0 12px 30px rgba(16,32,52,.1);
  --shadow-lg: 0 26px 60px rgba(16,32,52,.14);
  --glow:      0 0 0 1px rgba(6,168,124,.24), 0 10px 30px rgba(6,168,124,.14);
  --grad-surface: linear-gradient(160deg, rgba(12,22,34,.03), rgba(12,22,34,0) 60%);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; padding: 0; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--text-primary); }

[dir="ltr"] body { font-family: 'Sora', var(--font-body); }
.num { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -.02em; direction: ltr; unicode-bidi: isolate; }

/* ---------- layout ---------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 8vw, 7rem); position: relative; }
.section-head { max-width: 62ch; margin-bottom: 3rem; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row { display: flex; align-items: center; gap: .75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hide-mobile { display: initial; }
@media (max-width: 860px) { .hide-mobile { display: none !important; } }

/* ---------- the pip axis (signature) ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-mono); font-size: var(--step--1);
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 1rem;
}
.eyebrow::before {
  content: ''; width: 34px; height: 12px; flex: none;
  background-image: repeating-linear-gradient(to right, currentColor 0 1px, transparent 1px 6px);
  opacity: .65;
}
.pip-rule {
  height: 14px;
  background-image: repeating-linear-gradient(to right, var(--border-strong) 0 1px, transparent 1px 9px);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .78rem 1.5rem; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--border); cursor: pointer;
  font-weight: 600; font-size: var(--step-0); line-height: 1;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn--primary { --btn-bg: var(--grad-accent); --btn-fg: #04140F; border-color: transparent; font-weight: 700; }
.btn--primary:hover { box-shadow: var(--glow); }
.btn--gold { --btn-bg: var(--grad-gold); --btn-fg: #1B1200; border-color: transparent; font-weight: 700; }
.btn--ghost { --btn-bg: transparent; border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-hover); }
.btn--danger { --btn-bg: rgba(255,92,110,.12); --btn-fg: var(--danger); border-color: rgba(255,92,110,.3); }
.btn--sm { padding: .5rem 1rem; font-size: var(--step--1); }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  position: relative;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card--hover:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card--glass { background: var(--surface-glass); backdrop-filter: blur(18px); }
.card__title { font-size: var(--step-1); margin-bottom: .4rem; }
.card__meta { color: var(--text-secondary); font-size: var(--step--1); }

/* KPI */
.kpi { display: grid; gap: .55rem; padding: 1.35rem 1.5rem; }
.kpi__label { color: var(--text-secondary); font-size: var(--step--1); display: flex; align-items: center; gap: .5rem; }
.kpi__value { font-family: var(--font-mono); font-size: var(--step-2); font-weight: 600; letter-spacing: -.03em; direction: ltr; }
.kpi__delta { font-size: var(--step--1); display: inline-flex; align-items: center; gap: .3rem; }
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }
.kpi__spark { height: 34px; margin-top: .2rem; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .7rem; border-radius: var(--radius-pill);
  font-size: var(--step--1); font-weight: 600; line-height: 1.5;
  border: 1px solid transparent; white-space: nowrap;
}
.badge--ok    { background: rgba(18,214,160,.12); color: var(--success); border-color: rgba(18,214,160,.28); }
.badge--warn  { background: rgba(232,182,90,.12); color: var(--warning); border-color: rgba(232,182,90,.28); }
.badge--bad   { background: rgba(255,92,110,.12); color: var(--danger); border-color: rgba(255,92,110,.28); }
.badge--info  { background: rgba(76,141,255,.12); color: var(--info); border-color: rgba(76,141,255,.28); }
.badge--muted { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.badge--gold  { background: rgba(232,182,90,.14); color: var(--accent-2); border-color: rgba(232,182,90,.3); }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--step--1); color: var(--text-secondary);
  transition: var(--transition); cursor: pointer;
}
.chip:hover, .chip.is-active { color: var(--text-primary); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- forms ---------- */
.field { display: grid; gap: .45rem; margin-bottom: 1.15rem; }
.field label { font-size: var(--step--1); color: var(--text-secondary); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; padding: .8rem 1rem;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393A4B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 1rem center; padding-left: 2.4rem; }
[dir="ltr"] .select { background-position: right 1rem center; padding-left: 1rem; padding-right: 2.4rem; }
.field__error { color: var(--danger); font-size: var(--step--1); }
.field--invalid .input, .field--invalid .select, .field--invalid .textarea { border-color: var(--danger); }
.field__hint { color: var(--text-muted); font-size: var(--step--1); }
.checkbox { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; font-size: var(--step--1); color: var(--text-secondary); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin-top: .15rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th, .table td { padding: .9rem 1rem; text-align: start; white-space: nowrap; }
.table thead th {
  color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; font-size: .72rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-hover); }
.table td .num { font-size: .85rem; }

@media (max-width: 820px) {
  .table-cards thead { display: none; }
  .table-cards tbody tr { display: grid; gap: .4rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; }
  .table-cards td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; white-space: normal; }
  .table-cards td::before { content: attr(data-label); color: var(--text-muted); font-size: .75rem; }
}

/* ---------- progress ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.progress__bar { height: 100%; background: var(--grad-accent); border-radius: inherit; transition: width .6s cubic-bezier(.4,0,.2,1); }
.ring { --p: 0; width: 74px; height: 74px; display: grid; place-items: center; border-radius: 50%; position: relative; flex: none; }
.ring::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}
.ring span { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; }

/* ---------- alerts / toast ---------- */
.alert { display: flex; gap: .8rem; padding: 1rem 1.15rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); font-size: var(--step--1); }
.alert--ok { border-color: rgba(18,214,160,.3); background: rgba(18,214,160,.08); }
.alert--bad { border-color: rgba(255,92,110,.3); background: rgba(255,92,110,.08); }
.alert--warn { border-color: rgba(232,182,90,.3); background: rgba(232,182,90,.08); }
.alert .icon { flex: none; width: 20px; height: 20px; margin-top: .15rem; }

#toasts { position: fixed; inset-block-end: 1.5rem; inset-inline-end: 1.5rem; display: grid; gap: .6rem; z-index: 9999; max-width: min(92vw, 380px); }
.toast {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .9rem 1.1rem; border-radius: var(--radius); font-size: var(--step--1);
  background: var(--surface-glass); backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: toast-in .32s cubic-bezier(.2,.9,.3,1);
}
.toast--success { border-inline-start: 3px solid var(--success); }
.toast--error { border-inline-start: 3px solid var(--danger); }
.toast--warning { border-inline-start: 3px solid var(--warning); }
.toast--info { border-inline-start: 3px solid var(--info); }
.toast.is-out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,8,13,.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 1.25rem; z-index: 9000;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 1.75rem; box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(.98); transition: transform var(--transition);
  max-height: 88vh; overflow-y: auto;
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__title { font-size: var(--step-1); margin-bottom: .5rem; }
.modal__body { color: var(--text-secondary); font-size: var(--step--1); }
.modal__actions { display: flex; gap: .7rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- empty & skeleton ---------- */
.empty { text-align: center; padding: 3.5rem 1.5rem; color: var(--text-secondary); }
.empty__icon { width: 56px; height: 56px; margin: 0 auto 1.1rem; color: var(--accent); opacity: .7; }
.empty h3 { font-size: var(--step-1); color: var(--text-primary); margin-bottom: .4rem; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 800; height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
  backdrop-filter: blur(18px); border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}
.site-header.is-stuck { border-bottom-color: var(--border); }
.site-header .container { display: flex; align-items: center; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-family: var(--font-display); font-weight: 800; font-size: 1.06rem; letter-spacing: -.02em; }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand small { display: block; font-size: .62rem; letter-spacing: .22em; color: var(--accent); font-family: var(--font-mono); font-weight: 500; }
.nav { display: flex; align-items: center; gap: .35rem; margin-inline-start: auto; }
.nav a { padding: .55rem .9rem; border-radius: var(--radius-pill); font-size: var(--step--1); color: var(--text-secondary); transition: var(--transition); }
.nav a:hover, .nav a.is-active { color: var(--text-primary); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid var(--border); background: transparent;
  cursor: pointer; color: var(--text-secondary); transition: var(--transition); position: relative;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn__dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-primary); }

.menu-toggle { display: none; }
@media (max-width: 1040px) {
  .nav { position: fixed; inset-block-start: var(--header-h); inset-inline: 0; flex-direction: column; align-items: stretch; gap: .2rem; padding: 1rem 1.25rem 2rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border); transform: translateY(-120%); transition: transform var(--transition); margin: 0; }
  .nav.is-open { transform: none; }
  .nav a { padding: .85rem 1rem; }
  .menu-toggle { display: grid; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-secondary); padding-block: 4rem 2rem; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(auto-fit, minmax(150px, 1fr)); gap: 2.5rem; }
.footer-col h4 { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); margin-bottom: 1rem; font-family: var(--font-mono); font-weight: 500; }
.footer-col a { display: block; padding: .3rem 0; color: var(--text-secondary); font-size: var(--step--1); transition: var(--transition); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--text-muted); font-size: var(--step--1); }
.disclaimer { margin-top: 1.5rem; padding: 1.1rem 1.25rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); font-size: .78rem; line-height: 1.8; }

/* ---------- utilities ---------- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-gold { color: var(--accent-2); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2.5rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}.mb-4{margin-bottom:2.5rem}
.w-full{width:100%}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--border); margin-block: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
