/*
 * Aisar.io App CSS — port of SDCA frontend/src/styles.css for qadah PHP.
 *
 * Loaded together with the Tailwind Play CDN (which is configured inline in
 * each layout to match SDCA's tailwind.config.js). This file provides:
 *   - Font + icon imports (IBM Plex Sans Arabic, Inter, Material Symbols)
 *   - M3 design tokens as CSS variables (the same names SDCA uses)
 *   - Component classes Tailwind alone can't do: .glass-card, .bg-mesh,
 *     .progress-glow, .shadow-glow, .aisar-btn, .aisar-input, .aisar-tag.
 *   - Auto-promotion of legacy `.bg-white.rounded-*` to glass cards.
 *
 * Keep this file in sync with sdca-platform/frontend/src/styles.css.
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

:root {
  --aisar-primary: #006e06;
  --aisar-primary-bright: #32ff32;
  --aisar-bg: #f9f9f8;
  --aisar-border: rgba(0, 0, 0, 0.05);
  --aisar-border-strong: #baccb1;
  --aisar-text: #191c1c;
  --aisar-text-secondary: #5f5e5e;
  --aisar-text-tertiary: #94A3B8;
  /* Backwards-compat: legacy navy/teal vars point at green */
  --aisar-navy: #006e06;
  --aisar-navy-hover: #005303;
  --aisar-teal: #32ff32;
  --aisar-teal-hover: #00e61a;
  --aisar-amber: #F59E0B;
  --aisar-cloud: #f9f9f8;
}

html, body {
  font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
  background-color: var(--aisar-bg);
  color: var(--aisar-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--aisar-text); }
h1 { font-size: 32px; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 24px; line-height: 1.3; }
h3 { font-size: 20px; line-height: 1.4; }
h4 { font-size: 18px; line-height: 1.4; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  user-select: none;
}

/* ──────────────────────────────────────────────────────────────────
   GLASS CARD — translucent with blur
   ────────────────────────────────────────────────────────────────── */
.glass-card,
.aisar-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  border-radius: 0.75rem;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.glass-card:hover,
.aisar-card:hover {
  border-color: rgba(186, 204, 177, 0.6);
}

/* Legacy `bg-white rounded-*` cards auto-glass */
.bg-white.rounded-xl,
.bg-white.rounded-lg,
.bg-white.rounded-2xl {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(186, 204, 177, 0.35);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.04);
}

/* Soft elevations — replaces the old hard lime halos with gentle shadows. */
.glow-border:hover    { box-shadow: 0 6px 20px -6px rgba(0, 110, 6, 0.20); }
.progress-glow        { box-shadow: 0 0 6px rgba(0, 110, 6, 0.30); }
.active-glow          { box-shadow: 0 10px 28px -10px rgba(0, 110, 6, 0.25); }
.shadow-glow          { box-shadow: 0 8px 24px -8px rgba(0, 110, 6, 0.20); }
.shadow-glow-strong   { box-shadow: 0 14px 32px -10px rgba(0, 110, 6, 0.28); }

.bg-mesh {
  background-color: #f9f9f8;
  background-image:
    radial-gradient(at 0% 0%, hsla(120, 100%, 90%, 0.4) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(120, 100%, 95%, 0.3) 0px, transparent 50%);
}
[dir='rtl'] .bg-mesh {
  background-image:
    radial-gradient(at 100% 0%, hsla(120, 100%, 90%, 0.4) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsla(120, 100%, 95%, 0.3) 0px, transparent 50%);
}

/* ──────────────────────────────────────────────────────────────────
   AISAR BUTTONS — single soft identity used across the whole app
   ──────────────────────────────────────────────────────────────────
   Design rules:
     - rounded-md (8px) corners, never sharp 2px
     - no uppercase / extreme letter-spacing
     - soft shadow on hover, not glow ring
     - solid green (#006e06) primary, white-glass secondary, grey ghost
     - no harsh black backgrounds with lime stripes anywhere
   The same look is applied to legacy class names (.dz-*, .ais-*) at the
   bottom of this section so every page picks it up without edits. */
.aisar-btn,
.aisar-btn-primary,
.aisar-btn-cta,
.aisar-btn-secondary,
.aisar-btn-ghost,
.dz-cta-primary,
.dz-btn-pri,
.dz-btn-sec,
.dz-ghost-btn,
.ais-cta-dark,
.ais-cta-green,
.ais-btn-pri,
.ais-btn-green,
.ais-btn-sec,
.ais-btn-ghost,
.ais-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 40px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease,
              transform 120ms ease, box-shadow 200ms ease, color 180ms ease;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.2;
}
.aisar-btn:active,
.dz-cta-primary:active,
.dz-btn-pri:active,
.dz-btn-sec:active,
.dz-ghost-btn:active,
.ais-cta-dark:active,
.ais-cta-green:active,
.ais-btn-pri:active,
.ais-btn-green:active,
.ais-btn-sec:active,
.ais-btn-ghost:active,
.ais-picker-btn:active { transform: translateY(1px); }

.aisar-btn:focus-visible,
.dz-cta-primary:focus-visible,
.dz-btn-pri:focus-visible,
.dz-btn-sec:focus-visible,
.dz-ghost-btn:focus-visible,
.ais-cta-dark:focus-visible,
.ais-cta-green:focus-visible,
.ais-btn-pri:focus-visible,
.ais-btn-green:focus-visible,
.ais-btn-sec:focus-visible,
.ais-btn-ghost:focus-visible,
.ais-picker-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 110, 6, 0.18);
}

.aisar-btn:disabled,
.dz-cta-primary:disabled,
.dz-btn-pri:disabled,
.ais-cta-dark:disabled,
.ais-cta-green:disabled,
.ais-btn-pri:disabled,
.ais-btn-green:disabled {
  background: #E2E8F0 !important;
  color: #94A3B8 !important;
  cursor: not-allowed;
  border-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* PRIMARY — solid green, white text */
.aisar-btn-primary,
.aisar-btn-cta,
.dz-cta-primary,
.dz-btn-pri,
.ais-cta-dark,
.ais-cta-green,
.ais-btn-pri,
.ais-btn-green {
  background: var(--aisar-primary);
  color: #ffffff;
  border-color: var(--aisar-primary);
  border-bottom-color: var(--aisar-primary);   /* override sharp lime stripes */
  box-shadow: 0 1px 2px rgba(0, 110, 6, 0.10);
}
.aisar-btn-primary:hover,
.aisar-btn-cta:hover,
.dz-cta-primary:hover,
.dz-btn-pri:hover,
.ais-cta-dark:hover,
.ais-cta-green:hover,
.ais-btn-pri:hover,
.ais-btn-green:hover {
  background: var(--aisar-navy-hover);
  color: #ffffff;
  border-color: var(--aisar-navy-hover);
  box-shadow: 0 6px 18px -6px rgba(0, 110, 6, 0.35);
  text-decoration: none;
}

/* SECONDARY — soft glass, green border */
.aisar-btn-secondary,
.dz-btn-sec,
.ais-btn-sec,
.ais-picker-btn {
  background: rgba(255, 255, 255, 0.7);
  color: var(--aisar-primary);
  border-color: rgba(0, 110, 6, 0.22);
  backdrop-filter: blur(8px);
}
.aisar-btn-secondary:hover,
.dz-btn-sec:hover,
.ais-btn-sec:hover,
.ais-picker-btn:hover {
  background: rgba(0, 110, 6, 0.06);
  color: var(--aisar-primary);
  border-color: var(--aisar-primary);
  text-decoration: none;
}

/* GHOST — quiet, used for Cancel / breadcrumbs */
.aisar-btn-ghost,
.dz-ghost-btn,
.ais-btn-ghost {
  background: transparent;
  color: var(--aisar-text-secondary);
  border-color: rgba(0, 0, 0, 0.08);
}
.aisar-btn-ghost:hover,
.dz-ghost-btn:hover,
.ais-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--aisar-text);
  border-color: rgba(0, 0, 0, 0.16);
  text-decoration: none;
}

/* Danger variant — soft red, never harsh */
.aisar-btn-danger,
.dz-btn-danger,
.ais-btn-danger {
  background: rgba(186, 26, 26, 0.08);
  color: #ba1a1a;
  border: 1px solid rgba(186, 26, 26, 0.20);
  padding: 10px 18px;
  min-height: 40px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 180ms ease;
  text-decoration: none;
}
.aisar-btn-danger:hover,
.dz-btn-danger:hover,
.ais-btn-danger:hover {
  background: rgba(186, 26, 26, 0.14);
  border-color: rgba(186, 26, 26, 0.40);
}

/* Optional size modifier */
.aisar-btn-sm,
.dz-btn-sm,
.ais-btn-sm { padding: 6px 12px; min-height: 32px; font-size: 12px; border-radius: 8px; }

/* ──────────────────────────────────────────────────────────────────
   AISAR INPUTS
   ────────────────────────────────────────────────────────────────── */
.aisar-input,
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="tel"], input[type="url"], input[type="date"],
textarea, select {
  height: 40px;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.25rem;
  padding: 0 12px;
  font-size: 14px;
  color: var(--aisar-text);
  font-family: inherit;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.6; }
.aisar-input:hover,
input:hover, textarea:hover, select:hover {
  border-color: var(--aisar-border-strong);
}
.aisar-input:focus,
input:focus, textarea:focus, select:focus {
  outline: none;
  border: 1.5px solid var(--aisar-primary);
  box-shadow: 0 0 0 3px rgba(0, 110, 6, 0.10);
}
.aisar-input::placeholder,
input::placeholder, textarea::placeholder { color: var(--aisar-text-tertiary); }
.aisar-input:disabled,
input:disabled, textarea:disabled, select:disabled {
  background: var(--aisar-cloud);
  color: var(--aisar-text-tertiary);
}

[dir='rtl'] input, [dir='rtl'] textarea, [dir='rtl'] select { text-align: right; }

/* ──────────────────────────────────────────────────────────────────
   AISAR TAG
   ────────────────────────────────────────────────────────────────── */
.aisar-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 0.125rem;
  background: rgba(0, 110, 6, 0.08);
  color: var(--aisar-primary);
  border: 1px solid rgba(0, 110, 6, 0.18);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shadow-soft { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.rtl-flip { transform: scaleX(-1); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ──────────────────────────────────────────────────────────────────
   TYPOGRAPHY HELPERS — match SDCA fontSize tokens (Tailwind alias `text-*`)
   These exist as Tailwind classes too via the inline config, but we
   declare them here so they apply even before Tailwind CDN loads.
   ────────────────────────────────────────────────────────────────── */
.text-label-mono   { font-size: 12px; line-height: 16px; letter-spacing: 0.05em; font-weight: 600; }
.text-label-caps   { font-size: 11px; line-height: 16px; letter-spacing: 0.05em; font-weight: 600; }
.text-body-sm      { font-size: 14px; line-height: 20px; font-weight: 400; }
.text-body-md      { font-size: 16px; line-height: 24px; font-weight: 400; }
.text-body-base    { font-size: 16px; line-height: 24px; font-weight: 400; }
.text-body-lg      { font-size: 17px; line-height: 28px; font-weight: 400; }
.text-title-sm     { font-size: 18px; line-height: 24px; font-weight: 600; }
.text-title-md     { font-size: 18px; line-height: 24px; font-weight: 600; }
.text-headline-md  { font-size: 32px; line-height: 40px; letter-spacing: -0.01em; font-weight: 600; }
.text-headline-lg  { font-size: 32px; line-height: 40px; letter-spacing: -0.01em; font-weight: 600; }
.text-headline-xl  { font-size: 48px; line-height: 56px; letter-spacing: -0.02em; font-weight: 700; }
.text-display-md   { font-size: 32px; line-height: 40px; letter-spacing: -0.01em; font-weight: 600; }
.text-display-lg   { font-size: 48px; line-height: 56px; letter-spacing: -0.02em; font-weight: 700; }
.text-display-xl   { font-size: 48px; line-height: 56px; letter-spacing: -0.02em; font-weight: 700; }
.text-ai-monospaced{ font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 14px; line-height: 20px; font-weight: 500; }

/* The legacy bridge section that used to live here has been removed.
 * `qadah-cloud-theme.css` (loaded after this file in <head>) is now the
 * single source of truth for: .page-header, .display, .lead, .muted, .faint,
 * .eyebrow, .card, .stat-grid, .stat-card, .empty-state, .btn / .btn-primary
 * / .btn-accent / .btn-secondary / .btn-ghost / .btn-danger, .alert family,
 * .badge family, .field, table styles, .divider, .avatar.
 *
 * Pages that use legacy class names now render with SDCA's exact navy +
 * teal cloud-theme (matching SDCA's qadah-legacy/* components 1:1). */
