/* ══════════════════════════════════════════════
   HalaAI Brand System v2.0
   Teal / Cyan gradient · Dark-mode-first
   ══════════════════════════════════════════════ */

/* ── Font Imports ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Baloo+Bhaijaan+2:wght@400;500;600;700;800&family=Fredoka:wght@300;400;500;600;700&display=swap');

/* ── Brand Tokens ── */
:root {
    /* Primary — cyan/blue (matching AI logo) */
    --brand-primary: #22D3EE;
    --brand-primary-hover: #06B6D4;
    --brand-primary-dark: #0891B2;
    --brand-primary-deeper: #0E7490;

    /* Blue accent (gradient endpoint) */
    --brand-cyan: #60A5FA;
    --brand-cyan-dark: #3B82F6;

    /* Gradient — cyan → blue */
    --brand-gradient: linear-gradient(135deg, #22D3EE 0%, #60A5FA 100%);
    --brand-gradient-hover: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);
    --brand-gradient-reverse: linear-gradient(135deg, #60A5FA 0%, #22D3EE 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(34,211,238,0.15) 0%, rgba(96,165,250,0.15) 100%);
    --brand-gradient-text: linear-gradient(135deg, #22D3EE, #60A5FA);

    /* Gold accent */
    --brand-gold: #FBBF24;
    --brand-gold-dark: #F59E0B;
    --brand-gold-dim: #D97706;

    /* Dark surfaces */
    --surface-bg: #0B1120;
    --surface-card: #111827;
    --surface-card-hover: #1A2332;
    --surface-elevated: #1E293B;
    --surface-overlay: rgba(11, 17, 32, 0.8);

    /* Light surfaces */
    --surface-light: #FAFBFC;
    --surface-light-card: #FFFFFF;
    --surface-light-hover: #F1F5F9;

    /* Neutral scale */
    --neutral-50: #F8FAFC;
    --neutral-100: #F1F5F9;
    --neutral-200: #E2E8F0;
    --neutral-300: #CBD5E1;
    --neutral-400: #94A3B8;
    --neutral-500: #64748B;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1E293B;
    --neutral-900: #0F172A;

    /* Semantic */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-dark-primary: #0F172A;
    --text-dark-secondary: #475569;
    --border-color: #1E293B;
    --border-light: #E2E8F0;

    /* Brand RGBA */
    --brand-primary-10: rgba(34, 211, 238, 0.10);
    --brand-primary-15: rgba(34, 211, 238, 0.15);
    --brand-primary-20: rgba(34, 211, 238, 0.20);
    --brand-primary-06: rgba(34, 211, 238, 0.06);
    --brand-cyan-10: rgba(96, 165, 250, 0.10);
    --brand-cyan-15: rgba(96, 165, 250, 0.15);

    /* Status colors */
    --status-success: #10B981;
    --status-warning: #F59E0B;
    --status-error: #F43F5E;
    --status-info: #38BDF8;

    /* Fonts */
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-logo-ar: 'Baloo Bhaijaan 2', 'DM Sans', system-ui, sans-serif;
    --font-logo-en: 'Fredoka', 'DM Sans', system-ui, sans-serif;
}

/* ── Logo Component ── */
.brand-logo-text {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    text-decoration: none;
    line-height: 1;
}

.brand-logo-text .hala-part {
    font-family: var(--font-logo-ar);
    font-weight: 700;
    color: var(--text-primary);
}

.brand-logo-text .ai-part {
    font-family: var(--font-logo-en);
    font-weight: 600;
    background: var(--brand-gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Size variants */
.brand-logo-text.logo-sm .hala-part { font-size: 18px; }
.brand-logo-text.logo-sm .ai-part   { font-size: 16px; }
.brand-logo-text.logo-md .hala-part  { font-size: 22px; }
.brand-logo-text.logo-md .ai-part    { font-size: 20px; }
.brand-logo-text.logo-lg .hala-part  { font-size: 32px; }
.brand-logo-text.logo-lg .ai-part    { font-size: 28px; }
.brand-logo-text.logo-xl .hala-part  { font-size: 44px; }
.brand-logo-text.logo-xl .ai-part    { font-size: 40px; }

/* Light mode variant (dark text for هلا) */
.brand-logo-text.logo-light .hala-part {
    color: var(--text-dark-primary);
}

/* ── Brand Monogram (هـ) ── */
.brand-monogram {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 22%;
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.25);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.brand-monogram .mono-ar {
    font-family: var(--font-logo-ar);
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.brand-monogram .mono-en {
    font-family: var(--font-logo-en);
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    line-height: 1;
    margin-top: -2px;
}

.brand-monogram.mono-sm { width: 32px; height: 32px; border-radius: 22%; }
.brand-monogram.mono-sm .mono-ar { font-size: 0.85rem; }
.brand-monogram.mono-sm .mono-en { font-size: 0.32rem; letter-spacing: 1px; margin-top: -1px; }

.brand-monogram.mono-md { width: 42px; height: 42px; border-radius: 22%; }
.brand-monogram.mono-md .mono-ar { font-size: 1.3rem; }
.brand-monogram.mono-md .mono-en { font-size: 0.42rem; letter-spacing: 2px; }

.brand-monogram.mono-lg { width: 56px; height: 56px; border-radius: 22%; }
.brand-monogram.mono-lg .mono-ar { font-size: 1.7rem; }
.brand-monogram.mono-lg .mono-en { font-size: 0.55rem; letter-spacing: 2.5px; }

.brand-monogram.mono-xl { width: 64px; height: 64px; border-radius: 22%; }
.brand-monogram.mono-xl .mono-ar { font-size: 2rem; }
.brand-monogram.mono-xl .mono-en { font-size: 0.6rem; letter-spacing: 3px; }

/* ── Brand Avatar ── */
.brand-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--brand-gradient);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.brand-avatar.avatar-sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.brand-avatar.avatar-md { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; }
.brand-avatar.avatar-lg { width: 48px; height: 48px; font-size: 18px; border-radius: 12px; }

/* ── Brand Button ── */
.brand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 12px;
    background: var(--brand-gradient);
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.brand-btn:hover {
    background: var(--brand-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.3);
}

/* ── Utility Classes ── */
.text-brand { color: var(--brand-primary); }
.text-brand-cyan { color: var(--brand-cyan); }
.bg-brand-gradient { background: var(--brand-gradient); }
.bg-brand-subtle { background: var(--brand-gradient-subtle); }
.border-brand { border-color: var(--brand-primary); }

.text-gradient-brand {
    background: var(--brand-gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════════════════════
   LIGHT MODE — data-theme="light" overrides
   Apply to <html data-theme="light"> or any
   ancestor element.
   ══════════════════════════════════════════════ */
[data-theme="light"] {
    --surface-bg: #FAFBFC;
    --surface-card: #FFFFFF;
    --surface-card-hover: #F1F5F9;
    --surface-elevated: #F8FAFC;
    --surface-overlay: rgba(255, 255, 255, 0.8);

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border-color: #E2E8F0;

    --sidebar-bg-grad: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    --sidebar-surface: #F1F5F9;
    --sidebar-surface-hover: #E2E8F0;
    --sidebar-text: #334155;
    --sidebar-text-dim: #94A3B8;
}

/* Light mode logo text */
[data-theme="light"] .brand-logo-text .hala-part {
    color: var(--text-dark-primary);
}

/* Light mode monogram — keep gradient bg but ensure visibility */
[data-theme="light"] .brand-monogram {
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.15);
}

/* ══════════════════════════════════════════════
   ANIMATED WORDMARK
   Add .anim-wordmark to a container with
   .anim-hala and .anim-ai children.
   ══════════════════════════════════════════════ */
.anim-wordmark {
    display: flex;
    align-items: baseline;
    direction: ltr;
    position: relative;
    gap: 4px;
}

.anim-wordmark .anim-hala {
    font-family: var(--font-logo-ar);
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    transform: scale(2.5);
    filter: blur(8px);
    animation: halaEntranceLoop 6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s infinite;
}

.anim-wordmark .anim-ai {
    font-family: var(--font-logo-en);
    font-weight: 700;
    line-height: 1;
    background: var(--brand-gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transform: translateX(-60px) scaleX(1.8);
    animation: aiSlideStretchLoop 6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.0s infinite;
}

/* Dark text for هلا */
.anim-wordmark.on-dark .anim-hala { color: #FFFFFF; }
.anim-wordmark.on-light .anim-hala { color: #0F172A; }

/* Swoosh underline */
.anim-swoosh {
    position: relative;
}

.anim-swoosh::after {
    content: '';
    display: block;
    margin: 6px auto 0;
    width: 180px;
    height: 3px;
    border-radius: 3px;
    background: var(--brand-gradient);
    transform: scaleX(0);
    transform-origin: center;
    animation: swooshInLoop 6s cubic-bezier(0.22, 1, 0.36, 1) 1.7s infinite;
}

/* Particle container */
.anim-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.anim-particles .dot {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-primary);
    opacity: 0;
}

.anim-particles .line {
    position: absolute;
    width: 18px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--brand-cyan);
    opacity: 0;
}

.anim-particles .d1 { top: 20%; left: 10%; animation: burstDotLoop 6s ease-out 1.5s infinite; }
.anim-particles .d2 { top: 15%; right: 12%; animation: burstDotLoop 6s ease-out 1.6s infinite; }
.anim-particles .d3 { bottom: 20%; left: 15%; animation: burstDotLoop 6s ease-out 1.55s infinite; }
.anim-particles .d4 { bottom: 15%; right: 10%; animation: burstDotLoop 6s ease-out 1.65s infinite; }
.anim-particles .d5 { top: 30%; left: 5%; animation: burstDotLoop 6s ease-out 1.7s infinite; width: 3px; height: 3px; }
.anim-particles .d6 { bottom: 30%; right: 5%; animation: burstDotLoop 6s ease-out 1.58s infinite; width: 3px; height: 3px; }
.anim-particles .l1 { top: 25%; left: 5%; animation: burstLineLoop 6s ease-out 1.6s infinite; transform: rotate(-25deg); }
.anim-particles .l2 { top: 20%; right: 8%; animation: burstLineLoop 6s ease-out 1.52s infinite; transform: rotate(15deg); }
.anim-particles .l3 { bottom: 25%; right: 12%; animation: burstLineLoop 6s ease-out 1.68s infinite; transform: rotate(-40deg); }

/* Ambient floating dots */
.anim-ambient {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.anim-ambient.a1 { width: 4px; height: 4px; background: var(--brand-primary); top: 15%; left: 8%; animation: ambientFloat 3s ease-in-out 2.5s infinite; }
.anim-ambient.a2 { width: 3px; height: 3px; background: var(--brand-cyan); top: 25%; right: 6%; animation: ambientFloat 3s ease-in-out 2.8s infinite; }
.anim-ambient.a3 { width: 5px; height: 5px; background: var(--brand-primary); bottom: 20%; right: 12%; animation: ambientFloat 3s ease-in-out 3.1s infinite; }
.anim-ambient.a4 { width: 3px; height: 3px; background: var(--brand-cyan); bottom: 28%; left: 12%; animation: ambientFloat 3s ease-in-out 3.4s infinite; }

/* ── Keyframes ── */
/* Original one-shot keyframes (kept for other uses) */
@keyframes halaEntrance {
    0%   { opacity: 0; transform: scale(2.5); filter: blur(8px); }
    40%  { opacity: 1; filter: blur(0); }
    65%  { transform: scale(0.92); }
    80%  { transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes aiSlideStretch {
    0%   { opacity: 0; transform: translateX(-60px) scaleX(1.8); }
    30%  { opacity: 1; }
    55%  { transform: translateX(6px) scaleX(0.88); }
    75%  { transform: translateX(-3px) scaleX(1.06); }
    100% { opacity: 1; transform: translateX(0) scaleX(1); }
}

@keyframes swooshIn {
    0%   { transform: scaleX(0); opacity: 0; }
    40%  { opacity: 1; }
    100% { transform: scaleX(1); opacity: 1; }
}

@keyframes burstDot {
    0%   { opacity: 0; transform: scale(0); }
    30%  { opacity: 0.9; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(0.5) translateY(-15px); }
}

@keyframes burstLine {
    0%   { opacity: 0; transform: scaleX(0); }
    25%  { opacity: 0.8; transform: scaleX(1.3); }
    100% { opacity: 0; transform: scaleX(0.3); }
}

/* Looping keyframes — animate in, hold, fade out, pause */
@keyframes halaEntranceLoop {
    0%   { opacity: 0; transform: scale(2.5); filter: blur(8px); }
    6%   { opacity: 1; filter: blur(0); }
    10%  { transform: scale(0.92); }
    13%  { transform: scale(1.04); }
    15%  { opacity: 1; transform: scale(1); filter: blur(0); }
    75%  { opacity: 1; transform: scale(1); filter: blur(0); }
    85%  { opacity: 0; transform: scale(0.8); filter: blur(4px); }
    100% { opacity: 0; transform: scale(2.5); filter: blur(8px); }
}

@keyframes aiSlideStretchLoop {
    0%   { opacity: 0; transform: translateX(-60px) scaleX(1.8); }
    5%   { opacity: 1; }
    9%   { transform: translateX(6px) scaleX(0.88); }
    12%  { transform: translateX(-3px) scaleX(1.06); }
    15%  { opacity: 1; transform: translateX(0) scaleX(1); }
    75%  { opacity: 1; transform: translateX(0) scaleX(1); }
    85%  { opacity: 0; transform: translateX(40px) scaleX(0.5); }
    100% { opacity: 0; transform: translateX(-60px) scaleX(1.8); }
}

@keyframes swooshInLoop {
    0%   { transform: scaleX(0); opacity: 0; }
    6%   { opacity: 1; }
    15%  { transform: scaleX(1); opacity: 1; }
    75%  { transform: scaleX(1); opacity: 1; }
    85%  { transform: scaleX(0); opacity: 0; }
    100% { transform: scaleX(0); opacity: 0; }
}

@keyframes burstDotLoop {
    0%   { opacity: 0; transform: scale(0); }
    4%   { opacity: 0.9; transform: scale(1.5); }
    12%  { opacity: 0; transform: scale(0.5) translateY(-15px); }
    100% { opacity: 0; }
}

@keyframes burstLineLoop {
    0%   { opacity: 0; transform: scaleX(0); }
    4%   { opacity: 0.8; transform: scaleX(1.3); }
    12%  { opacity: 0; transform: scaleX(0.3); }
    100% { opacity: 0; }
}

@keyframes ambientFloat {
    0%, 100% { opacity: 0; transform: translateY(0); }
    20%      { opacity: 0.5; }
    50%      { opacity: 0.35; transform: translateY(-8px); }
    80%      { opacity: 0.15; }
}

/* ══════════════════════════════════════════════
   BOUNCING DOTS LOADER
   Use: <div class="brand-dots-loader"><span></span>...</div>
   ══════════════════════════════════════════════ */
.brand-dots-loader {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.brand-dots-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: brandDotBounce 1.4s ease-in-out infinite;
}

.brand-dots-loader span:nth-child(1) { background: var(--brand-cyan); animation-delay: 0s; }
.brand-dots-loader span:nth-child(2) { background: var(--brand-primary); animation-delay: 0.15s; }
.brand-dots-loader span:nth-child(3) { background: var(--brand-cyan); animation-delay: 0.3s; }
.brand-dots-loader span:nth-child(4) { background: var(--brand-primary); animation-delay: 0.45s; }

/* Small variant */
.brand-dots-loader.dots-sm span { width: 6px; height: 6px; gap: 6px; }

@keyframes brandDotBounce {
    0%, 80%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
    40% { transform: translateY(-14px) scale(1.2); opacity: 1; }
}

/* ── Spinner Ring Loader ── */
.brand-spinner {
    position: relative;
    width: 48px;
    height: 48px;
}

.brand-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--brand-cyan);
    border-right-color: var(--brand-primary);
    animation: brandSpin 1.2s linear infinite;
}

.brand-spinner::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom-color: rgba(52,211,153,0.3);
    border-left-color: rgba(34,211,238,0.3);
    animation: brandSpin 1.8s linear infinite reverse;
}

@keyframes brandSpin {
    to { transform: rotate(360deg); }
}

/* ── Pulse Ring Loader ── */
.brand-pulse-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-pulse-ring::before,
.brand-pulse-ring::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid var(--brand-primary);
    opacity: 0;
    animation: brandPulseRing 2s ease-out infinite;
}

.brand-pulse-ring::after {
    border-color: var(--brand-cyan);
    animation-delay: 0.6s;
}

@keyframes brandPulseRing {
    0% { transform: scale(0.6); opacity: 0.6; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ── Moyasar Payment Overlay ── */
.moyasar-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.moyasar-card {
    background: #fff;
    color: #1a1a2e;
    border-radius: 12px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    direction: rtl;
}

.moyasar-close {
    position: absolute;
    left: 12px;
    top: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}
.moyasar-close:hover { color: #333; }

.moyasar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #1a1a2e;
}
.moyasar-title i { margin-left: 8px; color: var(--brand-primary, #22d3ee); }

.moyasar-subtitle {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
}

.moyasar-form-wrapper {
    min-height: 200px;
    background: #fff;
}

.moyasar-footer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 16px;
}
.moyasar-footer i { margin-left: 4px; }

.moyasar-error {
    color: #e53e3e;
    text-align: center;
    padding: 2rem 0;
}
