/* ==========================================================================
   مَنح — Design System
   ========================================================================== */

@font-face {
    font-family: 'Greta Arabic';
    src: url('../fonts/greta_ar_light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Arabic';
    src: url('../fonts/greta_ar_regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Arabic';
    src: url('../fonts/greta_ar_medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Arabic';
    src: url('../fonts/greta_ar_bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Surface */
    --bg: #fafaf9;
    --surface: #ffffff;
    --surface-2: #f5f5f4;

    /* Borders */
    --border: #e7e5e4;
    --border-strong: #d6d3d1;

    /* Text */
    --ink: #0c0a09;
    --ink-muted: #44403c;
    --ink-subtle: #78716c;
    --ink-faint: #a8a29e;

    /* Brand */
    --brand-ink: #0e0135;
    --brand-ink-2: #1a0a4d;
    --accent: #3333ff;
    --accent-ink: #1f1f99;
    --accent-soft: #eef0ff;

    /* Semantic */
    --success: #047857;
    --success-soft: #ecfdf5;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --warning: #b45309;
    --warning-soft: #fffbeb;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(12, 10, 9, 0.04);
    --shadow: 0 1px 3px rgba(12, 10, 9, 0.06), 0 1px 2px rgba(12, 10, 9, 0.04);
    --shadow-lg: 0 10px 30px -10px rgba(12, 10, 9, 0.15), 0 4px 12px -4px rgba(12, 10, 9, 0.06);

    /* Radius */
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Greta Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-feature-settings: 'kern';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.65;
}

[x-cloak] { display: none !important; }

/* Subtle grid background texture on landing only */
.textured-bg {
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(51, 51, 255, 0.04), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(14, 1, 53, 0.03), transparent 40%);
}

/* Transitions */
.fade-enter-active { transition: opacity .35s ease, transform .35s ease; }
.fade-enter-from { opacity: 0; transform: translateY(6px); }

/* Focus ring — consistent */
*:focus { outline: none; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
    box-shadow: 0 0 0 3px rgba(51, 51, 255, 0.18);
    border-color: var(--accent) !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ---------- Components (reusable, keep minimal) ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--r);
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s ease, background .18s ease, border-color .18s ease, box-shadow .2s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--brand-ink);
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(14, 1, 53, 0.6);
}
.btn-primary:hover { background: var(--brand-ink-2); }

.btn-accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(51, 51, 255, 0.6);
}
.btn-accent:hover { background: var(--accent-ink); }

.btn-ghost {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(4, 120, 87, 0.55);
}
.btn-success:hover { filter: brightness(0.95); }

.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.input, .textarea, .select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.65; }
.label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-muted);
    margin-bottom: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
}
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: #dcdffb; }
.chip-neutral { background: var(--surface-2); color: var(--ink-muted); border-color: var(--border); }
.chip-success { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.chip-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

.dot {
    width: 8px; height: 8px; border-radius: 999px;
    background: currentColor;
    display: inline-block;
}
.pulse::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.4;
    animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.85); opacity: 0.5; } 100% { transform: scale(2); opacity: 0; } }

/* Steppers */
.stepper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-muted);
}
.stepper b { color: var(--ink); }

/* Table-ish rows */
.row-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.row-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

/* Progress bar (criterion) */
.progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 1s cubic-bezier(.2,.8,.2,1);
}

/* Upload dropzone */
.dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-xl);
    background: var(--surface);
    transition: border-color .2s ease, background .2s ease;
}
.dropzone:hover { border-color: var(--accent); background: #fbfbff; }
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }

/* Score ring (SVG wrapper) */
.score-ring {
    position: relative;
    width: 168px;
    height: 168px;
}
.score-ring .score-value {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    font-weight: 800;
}

/* Loading bar */
.loading-bar {
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
    width: 30%;
    animation: slide 1.6s ease-in-out infinite;
}
@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Spin */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline help text */
.help { font-size: 13px; color: var(--ink-subtle); line-height: 1.6; }

/* Divider */
.hr-label {
    display: flex; align-items: center; gap: 12px;
    color: var(--ink-subtle);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.hr-label::before, .hr-label::after {
    content: ""; flex: 1;
    height: 1px; background: var(--border);
}

/* Callout */
.callout {
    border-radius: var(--r-lg);
    padding: 20px 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.callout-danger { background: var(--danger-soft); border: 1px solid #fecaca; color: #7f1d1d; }
.callout-warning { background: var(--warning-soft); border: 1px solid #fde68a; color: #78350f; }
.callout-accent { background: var(--accent-soft); border: 1px solid #dcdffb; color: var(--accent-ink); }

/* Subtle hover lift */
.lift { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

/* Ribbons used in modal */
.modal-backdrop {
    background: rgba(12, 10, 9, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Utilities */
.mono-nums { font-variant-numeric: tabular-nums; }
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .score-ring { width: 140px; height: 140px; }
}
