/* tamar — modern design tokens (free system fonts, no paid assets).
 * Inspired by Boulevard / Mangomint / Booksy salon-app conventions:
 *   - Soft off-white background, pure white surfaces
 *   - Single accent color, muted secondary
 *   - Generous spacing, rounded corners, soft shadows
 *   - Bottom-sheet pattern on mobile, centered modals on tablet+
 */

:root {
    /* Color */
    --bg:           #f6f7f9;          /* page background */
    --surface:      #ffffff;          /* cards, dialogs, lists */
    --surface-2:    #f0f2f5;          /* hover, sublle separation */
    --border:       #e5e7eb;
    --border-strong:#cbd5e1;
    --text:         #111827;
    --text-muted:   #6b7280;
    --text-faint:   #9ca3af;

    --accent:       #2d6cdf;          /* primary CTA */
    --accent-hover: #2558bf;
    --accent-soft:  #e5edfb;          /* tinted bg for selected/focus */
    --success:      #16a34a;
    --warning:      #f59e0b;
    --danger:       #dc2626;
    --danger-soft:  #fee2e2;

    --holiday-red:  #b91c1c;
    --holiday-blue: #1d4ed8;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 "Arial Hebrew", system-ui, sans-serif;
    --font-mono: "SF Mono", Consolas, "Roboto Mono", monospace;

    /* Spacing scale (4px base) */
    --sp-1:  4px;
    --sp-2:  8px;
    --sp-3:  12px;
    --sp-4:  16px;
    --sp-5:  20px;
    --sp-6:  24px;
    --sp-8:  32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Radius */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;
    --r-xl:  20px;
    --r-pill: 999px;

    /* Shadows */
    --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-2: 0 2px 6px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-3: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);

    /* Touch targets */
    --tap: 44px;       /* Apple HIG minimum */
    --tap-sm: 36px;

    /* Safe area for notch / home indicator */
    --safe-top:    env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left:   env(safe-area-inset-left);
    --safe-right:  env(safe-area-inset-right);
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body { overscroll-behavior-y: none; }

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    min-height: var(--tap);
}

table { border-collapse: collapse; }

/* ---------- Typography hierarchy --------------------------------------
 * Modern SaaS pattern (Linear / Stripe / Mangomint): same primary text
 * color for ALL headings — hierarchy via size + weight + a 4px accent
 * indicator. NEVER a different color per heading.
 * Apply by class so existing components opt-in incrementally.
 * --------------------------------------------------------------------- */
.page-title {
    margin: 0 0 var(--sp-4) 0;
    padding-inline-start: var(--sp-3);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
    border-inline-start: 4px solid var(--accent);
}
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.page-title-row .page-title { margin: 0; }
.page-subtitle {
    margin: 0 0 var(--sp-4) calc(var(--sp-3) + 4px);
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}
.section-title {
    margin: 0 0 var(--sp-3) 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}
.card-title {
    margin: 0 0 var(--sp-2) 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* Modern surface card: white bg, subtle border, no heavy shadows. */
.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5) var(--sp-5);
    transition: border-color 150ms, box-shadow 150ms;
}
.surface-card:hover { border-color: var(--border-strong); }
.surface-card.compact { padding: var(--sp-3) var(--sp-4); }
.surface-card + .surface-card { margin-top: var(--sp-3); }

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    min-height: var(--tap);
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=checkbox], input[type=radio] {
    min-height: 0;
    padding: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    vertical-align: middle;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--r-md);
    font-weight: 500;
    transition: background 150ms ease, border-color 150ms ease, transform 80ms ease;
    min-height: var(--tap);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: var(--danger-soft);
}
.btn-danger:hover { background: var(--danger-soft); }

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

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: 13px; min-height: var(--tap-sm); }
.btn-icon {
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border-radius: var(--r-pill);
}

/* Backwards-compat: existing components still use .nimbus-btn — alias it. */
.nimbus-btn { @apply btn; }
.nimbus-btn { /* fallback non-tailwind */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--r-md);
    font-weight: 500;
    min-height: var(--tap);
    transition: background 150ms ease, border-color 150ms ease;
}
.nimbus-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.nimbus-btn:active { transform: scale(0.98); }
.nimbus-btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.nimbus-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.nimbus-btn.small { padding: var(--sp-1) var(--sp-3); font-size: 13px; min-height: var(--tap-sm); }
.nimbus-btn.danger {
    color: var(--danger);
    border-color: var(--danger-soft);
}
.nimbus-btn.danger:hover { background: var(--danger-soft); }

/* ---- Cards ---- */

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

/* ---- Touch helpers ---- */

.touch-tap {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

[dir="rtl"] { direction: rtl; }

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