/* ═══════════════════════════════════════════════════════════
   Innoovatum — Premium Design System v5 (Mobile-First)
   Primary: #6366F1  Dark: #4F46E5
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────── */
:root {
  --primary:        #6366F1;
  --primary-dark:   #4F46E5;
  --primary-light:  #EEF2FF;
  --primary-50:     #F0F0FF;
  --accent:         #22C55E;
  --danger:         #EF4444;
  --warning:        #F59E0B;

  --bg:             #F8FAFC;
  --surface:        #FFFFFF;
  --border:         #E2E8F0;
  --border-subtle:  #F1F5F9;
  --text:           #0F172A;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  --shadow-xs:  0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px 0 rgba(0,0,0,.07), 0 1px 2px -1px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);
  --shadow-primary: 0 8px 20px -4px rgba(99,102,241,.38);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.17,.67,.83,.67);
}

/* ── Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Prevent horizontal overflow globally */
body, main { max-width: 100vw; overflow-x: hidden; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Selection ───────────────────────────────────────────── */
::selection { background: rgba(99,102,241,.18); color: #1e1b4b; }

/* ── Focus ring ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(99,102,241,.5);
  outline-offset: 2px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,.13), 0 1px 3px rgba(0,0,0,.05);
}

/* ── Touch targets ───────────────────────────────────────── */
button, [role="button"] { touch-action: manipulation; }

/* ── Gradient text ───────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg,#a5b4fc 0%,#818cf8 45%,#c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-white {
  background: linear-gradient(135deg,#ffffff 0%,#e0e7ff 55%,#c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-text-primary {
  background: linear-gradient(135deg,#6366f1 0%,#4f46e5 50%,#7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Glassmorphism ───────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.12);
}
.glass-card {
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

/* ── Hero grid ───────────────────────────────────────────── */
.hero-grid {
  background-image: radial-gradient(circle,rgba(255,255,255,.06) 1px,transparent 1px);
  background-size: 28px 28px;
}

/* ── Noise texture ───────────────────────────────────────── */
.noise::after {
  content:''; position:absolute; inset:0; pointer-events:none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity:.04;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

/* Primary gradient button */
.btn-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,#6366f1 0%,#4f46e5 100%);
  color: #fff;
  font-weight: 600;
  min-height: 44px;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: filter .18s ease, transform .14s ease, box-shadow .18s ease;
  will-change: transform;
  white-space: nowrap;
}
.btn-gradient:hover {
  filter: brightness(1.09);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}
.btn-gradient:active { transform: scale(.98); filter: brightness(.97); }
/* Shimmer on hover */
.btn-gradient::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(105deg,transparent 40%,rgba(255,255,255,.12) 50%,transparent 60%);
  transform: translateX(-100%);
  transition: transform .45s ease;
}
.btn-gradient:hover::after { transform: translateX(100%); }

/* Outline button */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  color: var(--text);
  background: transparent;
  font-weight: 500;
  min-height: 44px;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s, transform .12s;
  white-space: nowrap;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(99,102,241,.12);
}
.btn-outline:active { transform: scale(.98); }

/* Ghost button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  background: transparent;
  font-weight: 500;
  min-height: 44px;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .13s, color .13s;
}
.btn-ghost:hover { background: var(--border-subtle); color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card-lift {
  transition: transform .22s var(--ease-spring), box-shadow .22s ease, border-color .22s ease;
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(99,102,241,.13), 0 6px 14px -4px rgba(0,0,0,.07);
  border-color: #dde1ff;
}

.card-premium {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .22s ease, border-color .22s ease, transform .22s var(--ease-spring);
}
.card-premium:hover {
  box-shadow: var(--shadow-xl);
  border-color: #dde1ff;
  transform: translateY(-2px);
}

/* Gradient border card */
.card-border-gradient {
  position: relative;
  background: #fff;
  border-radius: var(--radius-xl);
}
.card-border-gradient::before {
  content:'';
  position:absolute; inset:0; border-radius:inherit; padding:1px;
  background: linear-gradient(135deg,#e0e7ff,#ede9fe,#f0fdf4);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════ */

.input-premium {
  transition: border-color .15s, box-shadow .15s, background .15s;
  min-height: 44px;
}
.input-premium:focus {
  box-shadow: 0 0 0 3px rgba(99,102,241,.14), 0 1px 3px rgba(0,0,0,.06);
  outline: none;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR NAVIGATION
   ═══════════════════════════════════════════════════════════ */

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background .14s ease, color .14s ease;
  white-space: nowrap;
  min-height: 40px;
  position: relative;
  user-select: none;
}
.nav-link:hover { background: var(--border-subtle); color: var(--text); }
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.nav-link.active .nav-icon { color: var(--primary); }
/* Left accent bar on active */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.nav-active {
  color: var(--primary-dark) !important;
  background: var(--primary-light) !important;
  font-weight: 600 !important;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .6875rem; font-weight: 600; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 99px; white-space: nowrap;
}
.badge-indigo  { background:#EEF2FF; color:#4338CA; }
.badge-violet  { background:#F5F3FF; color:#6D28D9; }
.badge-emerald { background:#ECFDF5; color:#065F46; }
.badge-amber   { background:#FFFBEB; color:#92400E; }
.badge-red     { background:#FEF2F2; color:#991B1B; }
.badge-gray    { background:#F1F5F9; color:#334155; }
.badge-blue    { background:#EFF6FF; color:#1D4ED8; }

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY & CONTENT
   ═══════════════════════════════════════════════════════════ */

.prose p   { margin-bottom: .9rem; line-height: 1.78; }
.prose h3  { font-size: 1.05rem; font-weight: 700; margin: 1.6rem 0 .5rem; color: #111827; }
.prose ul  { padding-left: 1.4rem; list-style-type: disc; }
.prose li  { margin-bottom: .4rem; line-height: 1.68; }
.prose strong { font-weight: 600; color: #111827; }

.line-clamp-1 { display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

.stat-num { font-variant-numeric: tabular-nums; letter-spacing: -.03em; font-feature-settings: "tnum"; }

.divider-gradient {
  height: 1px;
  background: linear-gradient(90deg,transparent,var(--border),transparent);
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

main, .dashboard-main { animation: pageIn .22s var(--ease-out) both; }
@keyframes pageIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

.progress-bar { transition: width .85s var(--ease-spring); }

@keyframes shimmer { from { background-position:-200% 0; } to { background-position:200% 0; } }
.shimmer {
  background: linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes livePing { 75%,100% { transform:scale(2); opacity:0; } }
.live-dot { position: relative; display: inline-block; }
.live-dot::before {
  content:''; position:absolute; inset:0; border-radius:50%;
  background: currentColor;
  animation: livePing 1.5s cubic-bezier(0,0,.2,1) infinite;
}

@keyframes badgePop { 0% { transform:scale(.5); } 70% { transform:scale(1.15); } 100% { transform:scale(1); } }
.notif-badge-pop { animation: badgePop .2s ease forwards; }

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */

.table-row-hover:hover td { background: #F8FAFC; }

/* Horizontal scroll for tables on mobile */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══════════════════════════════════════════════════════════
   MISC UTILITIES
   ═══════════════════════════════════════════════════════════ */

.status-dot { width:6px; height:6px; border-radius:50%; display:inline-block; flex-shrink:0; }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%);
  background:#0F172A; color:#fff; font-size:11px; font-weight:500;
  white-space:nowrap; padding:4px 10px; border-radius:7px;
  pointer-events:none; opacity:0; transition:opacity .15s; z-index:100;
}
[data-tip]:hover::after { opacity:1; }

/* FAQ */
details.faq summary { cursor:pointer; list-style:none; }
details.faq summary::-webkit-details-marker { display:none; }

/* Field group icon */
.field-group { position: relative; }
.field-group input:focus + .field-icon,
.field-group input:not(:placeholder-shown) + .field-icon { color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   LEGAL PROSE
   ═══════════════════════════════════════════════════════════ */

.legal-prose { max-width:72ch; color:#374151; line-height:1.8; }
.legal-prose h2 {
  font-size:1.25rem; font-weight:700; color:#111827;
  margin:2.5rem 0 .75rem; padding-bottom:.5rem;
  border-bottom:1px solid #F3F4F6;
}
.legal-prose h3 { font-size:1rem; font-weight:600; color:#1f2937; margin:1.5rem 0 .4rem; }
.legal-prose p { margin-bottom:1rem; }
.legal-prose ul { list-style:none; padding:0; margin:.5rem 0 1rem; }
.legal-prose ul li { display:flex; gap:.6rem; align-items:flex-start; margin-bottom:.4rem; line-height:1.7; }
.legal-prose ul li::before {
  content:''; width:5px; height:5px; border-radius:50%;
  background:var(--primary); flex-shrink:0; margin-top:.55rem;
}
.legal-prose a { color:var(--primary-dark); text-decoration:underline; text-underline-offset:2px; }
.legal-prose strong { font-weight:600; color:#111827; }
.legal-prose .callout {
  background:var(--primary-light); border-left:3px solid var(--primary);
  border-radius:0 10px 10px 0; padding:1rem 1.25rem; margin:1.5rem 0; font-size:.875rem;
}

/* ═══════════════════════════════════════════════════════════
   QUILL EDITOR OVERRIDES
   ═══════════════════════════════════════════════════════════ */

.ql-toolbar { font-family:'Inter',sans-serif !important; border-color:#E2E8F0 !important; background:#F8FAFC; }
.ql-container { font-family:'Inter',sans-serif !important; border-color:#E2E8F0 !important; }
.ql-editor { min-height:140px; font-size:14px; line-height:1.7; }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE FIXES
   ═══════════════════════════════════════════════════════════ */

/* Prevent content overflow */
img { max-width:100%; height:auto; }
table { min-width:0; }
input, select, textarea, button { max-width:100%; }

/* Dashboard stat grid — 2 cols on mobile */
@media (max-width: 640px) {
  .dash-stats-3 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .dash-stats-5 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

  /* Smaller heading on mobile */
  h1 { font-size: clamp(1.25rem, 5vw, 1.75rem); }

  /* Tighter card padding on mobile */
  .card-mobile { padding: 1rem !important; }

  /* Hide non-essential table columns on mobile */
  .table-col-hide { display:none !important; }
}

/* Sidebar fixed at 260px on desktop; slide-over on mobile */
.sidebar-transition {
  will-change: transform;
  transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s ease;
}
