/* ============================================================
   IRA AI — main.css  (v2 — world-class redesign)
   Shared design tokens, resets, base typography, primitives.
   Every page imports this first.
   ============================================================ */

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

:root {
  /* ── Surfaces — deepened, cooler black so layers separate ── */
  --bg:        #07070B;
  --bg-2:      #0E0E16;
  --bg-3:      #15151F;
  --bg-4:      #1C1C29;
  --bg-5:      #24243380;

  /* ── Lines ── */
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(130,118,255,0.45);
  --line:      rgba(255,255,255,0.06);

  /* ── Ink ── */
  --text:      #F5F3FF;
  --text-2:    #A7A3C6;
  --text-3:    #5C5876;

  /* ── Brand ── */
  --accent:      #7C6FFF;
  --accent-2:    #9D93FF;
  --accent-deep: #5B4FE0;
  --accent-dim:  rgba(124,111,255,0.14);
  --accent-glow: rgba(124,111,255,0.30);

  /* ── Signal colors ── */
  --gold:   #F5C453;
  --green:  #22DDA8;
  --red:    #FF5C7A;
  --blue:   #5BA8FF;

  /* ── Type ── */
  --ff-head: 'Outfit', sans-serif;
  --ff-body: 'Inter', sans-serif;
  --ff-mono: 'JetBrains Mono', monospace;

  /* ── Radius ── */
  --r:    7px;
  --r-md: 11px;
  --r-lg: 17px;
  --r-xl: 24px;

  /* ── Elevation — layered, soft, never harsh ── */
  --shadow-sm: 0 2px 14px rgba(0,0,0,0.35);
  --shadow:    0 10px 44px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.03) inset;
  --shadow-lg: 0 24px 90px rgba(0,0,0,0.62);
  --shadow-glow: 0 8px 30px rgba(124,111,255,0.22);

  /* ── Motion ── */
  --t:      0.18s cubic-bezier(0.4,0,0.2,1);
  --t-slow: 0.32s cubic-bezier(0.16,1,0.3,1);
  --t-spring: 0.45s cubic-bezier(0.34,1.56,0.64,1);
  /* ── Compatibility aliases (legacy var names used in some admin pages) ── */
  --surface-1: var(--bg-3);
  --surface-2: var(--bg-4);
  --surface-3: var(--bg-2);
}

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

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--ff-body); background: var(--bg); color: var(--text);
  line-height: 1.6; overflow-x: hidden; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; font-feature-settings: "tnum" 1;
}

/* faint ambient grain + radial wash so flat black never feels dead */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124,111,255,0.07) 0%, transparent 60%);
}

/* ── SELECTION ── */
::selection { background: var(--accent); color: white; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

/* ── FOCUS — always visible, never silent ── */
:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px;
}
button:focus-visible, a:focus-visible { outline-offset: 3px; }

/* ── CONTAINER ── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }

/* ── ICON SYSTEM ── */
.ira-icon { width: 1.15em; height: 1.15em; display: block; }
[data-ira-icon] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }

/* ── FORM ELEMENTS ── */
input, textarea, select {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text); font-family: var(--ff-body);
  font-size: 0.9rem; padding: 10px 14px; outline: none; resize: vertical;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input:hover, textarea:hover, select:hover { border-color: rgba(255,255,255,0.14); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); background: var(--bg-4);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 5L10 1' stroke='%237C6FFF' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
select optgroup { font-weight: 700; color: var(--text-2); }

label { letter-spacing: 0.02em; }

/* ── BASE BUTTON RESET (component classes layer on top) ── */
button { font-family: inherit; }

/* ── SPIN ANIMATION ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin-ring {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2); border-top-color: white;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  vertical-align: middle; margin-right: 6px;
}

/* ── SKELETON SHIMMER (for loading states) ── */
@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.skel {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 37%, var(--bg-3) 63%);
  background-size: 400px 100%; animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-md);
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 9999;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-3); border: 1px solid var(--border-hi);
  color: var(--text); padding: 12px 22px; border-radius: 99px;
  font-size: 0.85rem; font-weight: 500; font-family: var(--ff-body);
  opacity: 0; pointer-events: none; white-space: nowrap;
  transition: all var(--t-spring);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(34,221,168,0.5); }
.toast.success::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 8px var(--green); flex-shrink:0; }
.toast.error   { border-color: rgba(255,92,122,0.5); }
.toast.error::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--red); box-shadow:0 0 8px var(--red); flex-shrink:0; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,4,8,0.72);
  backdrop-filter: blur(8px); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-xl); width: 100%; max-width: 720px;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.28s cubic-bezier(0.16,1,0.3,1);
}
@keyframes modalIn { from { opacity:0; transform: translateY(10px) scale(0.98); } to { opacity:1; transform: translateY(0) scale(1); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  font-family: var(--ff-head); font-weight: 700; font-size: 1rem;
}
.modal-close {
  background: none; border: none; color: var(--text-3); font-size: 1.1rem;
  cursor: pointer; padding: 6px; border-radius: var(--r);
  transition: color var(--t), background var(--t);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); background: var(--bg-3); }
.modal-body {
  padding: 24px; overflow-y: auto; flex: 1;
  font-size: 0.87rem; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
  color: var(--text-2);
}
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.btn-copy-modal, .btn-close-modal {
  padding: 10px 20px; border-radius: var(--r-md); font-family: var(--ff-head);
  font-weight: 600; font-size: 0.85rem; cursor: pointer; border: 1px solid var(--border);
  transition: all var(--t);
}
.btn-copy-modal { background: var(--accent); color: white; border-color: var(--accent); }
.btn-copy-modal:hover { background: var(--accent-2); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-close-modal { background: transparent; color: var(--text-2); }
.btn-close-modal:hover { background: var(--bg-3); color: var(--text); }

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ── GENERIC BADGE / PILL PRIMITIVE ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 99px; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.03em; white-space: nowrap; border: 1px solid transparent;
}

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE — main.css
══════════════════════════════════════════════ */
@media (max-width: 680px) {
  .modal { padding: 24px 18px; margin: 12px; width: calc(100% - 24px); max-width: 100%; box-sizing: border-box; }
  .modal h2 { font-size: 1.1rem; }
  .modal .fg input, .modal .fg select { font-size: 1rem; }
  .modal-actions { flex-direction: column; }
  .modal-actions button { width: 100%; }
  .toast { left: 12px; right: 12px; bottom: 12px; font-size: .88rem; }
}
