/* ==========================================================================
   Parkway THEME — Design Tokens & Base
   Apple iOS–inspired design language for ArnaMenu
   ========================================================================== */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../../fonts/Vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ---- Color: Neutrals (light default; dark-ready via paired tokens) ---- */
    --cp-bg: #F5F5F7;
    --cp-bg-secondary: #FFFFFF;
    --cp-bg-tertiary: #EFEFF4;
    --cp-surface: #FFFFFF;
    --cp-surface-secondary: #F2F2F7;
    --cp-surface-elevated: #FFFFFF;
    --cp-surface-grouped: #F2F2F7;
    --cp-fill: rgba(120, 120, 128, 0.16);
    --cp-fill-secondary: rgba(120, 120, 128, 0.12);
    --cp-fill-tertiary: rgba(120, 120, 128, 0.08);

    --cp-text-primary: #1D1D1F;
    --cp-text-secondary: #86868B;
    --cp-text-tertiary: #AEAEB2;
    --cp-text-quaternary: #C7C7CC;
    --cp-text-invert: #FFFFFF;
    --cp-text-main: var(--cp-text-primary);
    --cp-text-headings: var(--cp-text-primary);
    --cp-text-muted: var(--cp-text-secondary);
    --cp-text-light: var(--cp-text-tertiary);

    /* Material / glass (use sparingly) */
    --cp-material: rgba(255, 255, 255, 0.72);
    --cp-material-thick: rgba(255, 255, 255, 0.86);
    --cp-material-chrome: rgba(245, 245, 247, 0.78);
    --cp-surface-glass: var(--cp-material);
    --cp-surface-glass-heavy: var(--cp-material-thick);

    /* ---- Accent (iOS system blue) ---- */
    --cp-blue: #007AFF;
    --cp-blue-dark: #0066D6;
    --cp-blue-soft: rgba(0, 122, 255, 0.12);
    --cp-primary: var(--cp-blue);
    --cp-primary-hover: var(--cp-blue-dark);
    --cp-primary-active: #0055B3;
    --cp-primary-soft: var(--cp-blue-soft);
    --cp-primary-glow: 0 8px 20px -6px rgba(0, 122, 255, 0.28);

    /* Legacy pink aliases remapped (prevent leftover pink leakage) */
    --cp-pink-50: #F5F5F7;
    --cp-pink-100: #EFEFF4;
    --cp-pink-200: #E5E5EA;
    --cp-pink-300: #D1D1D6;
    --cp-pink-400: #8E8E93;
    --cp-pink-500: var(--cp-blue);
    --cp-pink-600: var(--cp-blue-dark);
    --cp-pink-700: #0055B3;
    --cp-pink-800: #004499;
    --cp-pink-900: #1D1D1F;

    /* Status */
    --cp-success: #34C759;
    --cp-success-soft: rgba(52, 199, 89, 0.14);
    --cp-warning: #FF9F0A;
    --cp-warning-soft: rgba(255, 159, 10, 0.14);
    --cp-danger: #FF3B30;
    --cp-danger-soft: rgba(255, 59, 48, 0.12);
    --cp-gold: #FF9F0A;
    --cp-gold-soft: rgba(255, 159, 10, 0.14);

    /* Borders & separators */
    --cp-separator: rgba(60, 60, 67, 0.12);
    --cp-border: rgba(60, 60, 67, 0.10);
    --cp-border-subtle: rgba(60, 60, 67, 0.08);
    --cp-border-soft: var(--cp-border-subtle);
    --cp-border-active: var(--cp-blue);

    /* ---- Geometry (hierarchy-aware radii) ---- */
    --cp-radius-xs: 10px;   /* small controls */
    --cp-radius-sm: 12px;   /* inputs */
    --cp-radius-md: 16px;   /* buttons */
    --cp-radius-lg: 20px;   /* standard cards */
    --cp-radius-xl: 26px;   /* large feature surfaces */
    --cp-radius-2xl: 30px;  /* sheets / modals */
    --cp-radius-pill: 9999px;

    /* ---- Spacing (4px grid) ---- */
    --cp-space-1: 4px;
    --cp-space-2: 8px;
    --cp-space-3: 12px;
    --cp-space-4: 16px;
    --cp-space-5: 20px;
    --cp-space-6: 24px;
    --cp-space-8: 32px;
    --cp-space-10: 40px;
    --cp-space-12: 48px;
    --cp-space-16: 64px;

    /* ---- Shadows (minimal, soft) ---- */
    --cp-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --cp-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --cp-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --cp-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.10);
    --cp-shadow-modal: 0 -8px 40px rgba(0, 0, 0, 0.12);
    --cp-shadow-float: 0 10px 30px rgba(0, 0, 0, 0.12);

    /* ---- Motion (iOS-inspired) ---- */
    --cp-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --cp-ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
    --cp-ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
    --cp-ease-smooth: var(--cp-ease-out);
    --cp-ease-bounce: var(--cp-ease-spring);
    --cp-motion-fast: 160ms;
    --cp-motion-normal: 280ms;
    --cp-motion-slow: 420ms;
    --cp-transition-fast: var(--cp-motion-fast) var(--cp-ease-out);
    --cp-transition-base: var(--cp-motion-normal) var(--cp-ease-out);

    /* ---- Typography ---- */
    --cp-font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --cp-font-hero: clamp(1.75rem, 4.2vw, 2.125rem);   /* 28–34 */
    --cp-font-section: clamp(1.375rem, 3vw, 1.625rem); /* 22–26 */
    --cp-font-product: clamp(1rem, 2.2vw, 1.1875rem);  /* 16–19 */
    --cp-font-body: clamp(0.875rem, 1.8vw, 1rem);      /* 14–16 */
    --cp-font-secondary: clamp(0.75rem, 1.5vw, 0.875rem); /* 12–14 */
    --cp-font-price: clamp(0.9375rem, 2vw, 1.125rem);  /* 15–18 */

    /* ---- Layout ---- */
    --cp-content-max: 980px;
    --cp-content-wide: 1120px;
    --cp-safe-top: env(safe-area-inset-top, 0px);
    --cp-safe-bottom: env(safe-area-inset-bottom, 0px);
    --cp-safe-inline: env(safe-area-inset-right, 0px);
    --cp-header-h: 56px;
    --cp-dock-h: 64px;
    --cp-touch: 44px;
    --cp-icon: 22px;
}

/* Dark mode hooks (future) */
@media (prefers-color-scheme: dark) {
    :root {
        /* Kept light-first; tokens ready for a dark class later */
    }
}

[data-cp-theme="dark"] {
    --cp-bg: #000000;
    --cp-bg-secondary: #1C1C1E;
    --cp-bg-tertiary: #2C2C2E;
    --cp-surface: #1C1C1E;
    --cp-surface-secondary: #2C2C2E;
    --cp-surface-elevated: #2C2C2E;
    --cp-surface-grouped: #000000;
    --cp-text-primary: #F5F5F7;
    --cp-text-secondary: #98989D;
    --cp-text-tertiary: #636366;
    --cp-separator: rgba(84, 84, 88, 0.65);
    --cp-border: rgba(84, 84, 88, 0.45);
    --cp-material: rgba(28, 28, 30, 0.72);
    --cp-material-thick: rgba(28, 28, 30, 0.86);
    --cp-material-chrome: rgba(0, 0, 0, 0.72);
}

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

html {
    font-family: var(--cp-font-family);
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body.cp-body {
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    background-color: var(--cp-bg);
    color: var(--cp-text-primary);
    font-family: var(--cp-font-family);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.cp-ambient-orb { display: none !important; }

.cp-container {
    width: 100%;
    max-width: var(--cp-content-max);
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 24px);
}

.cp-main {
    flex: 1 0 auto;
    position: relative;
    z-index: 1;
    padding-bottom: calc(88px + var(--cp-safe-bottom));
}

h1, h2, h3, h4, h5, h6 {
    color: var(--cp-text-primary);
    font-weight: 600;
    margin-top: 0;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

a {
    color: var(--cp-primary);
    text-decoration: none;
    transition: opacity var(--cp-transition-fast);
}

a:hover { opacity: 0.82; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.cp-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--cp-text-secondary);
    background: var(--cp-fill-tertiary);
    padding: 4px 10px;
    border-radius: var(--cp-radius-pill);
    margin-bottom: var(--cp-space-3);
    border: none;
}

/* ---- Buttons ---- */
.cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 12px 20px;
    border-radius: var(--cp-radius-md);
    transition: transform var(--cp-transition-fast), opacity var(--cp-transition-fast), background var(--cp-transition-fast);
    white-space: nowrap;
    text-align: center;
    user-select: none;
    min-height: var(--cp-touch);
    border: 1px solid transparent;
}

.cp-btn:active {
    transform: scale(0.97);
}

.cp-btn--primary {
    background: var(--cp-primary);
    color: var(--cp-text-invert);
}

.cp-btn--primary:hover {
    background: var(--cp-primary-hover);
    color: var(--cp-text-invert);
    opacity: 1;
}

.cp-btn--outline,
.cp-btn--secondary {
    background: var(--cp-fill-tertiary);
    color: var(--cp-text-primary);
    border-color: transparent;
}

.cp-btn--outline:hover,
.cp-btn--secondary:hover {
    background: var(--cp-fill-secondary);
    color: var(--cp-text-primary);
    opacity: 1;
}

.cp-btn--tertiary,
.cp-btn--glass {
    background: transparent;
    color: var(--cp-primary);
    border: none;
    min-height: auto;
    padding: 8px 12px;
}

.cp-btn--tertiary:hover,
.cp-btn--glass:hover {
    opacity: 0.7;
}

/* ---- Loader ---- */
.cp-loader {
    position: fixed;
    inset: 0;
    background: var(--cp-bg);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity var(--cp-motion-slow) var(--cp-ease-out), visibility var(--cp-motion-slow) var(--cp-ease-out);
}

.cp-loader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cp-loader__crest {
    width: 48px;
    height: 48px;
    opacity: 0.9;
    animation: cpPulse 1.2s var(--cp-ease-in-out) infinite;
}

@keyframes cpPulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

.cp-loader__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--cp-text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.cp-loader__bar {
    width: 120px;
    height: 3px;
    background: var(--cp-fill);
    border-radius: var(--cp-radius-pill);
    overflow: hidden;
    position: relative;
}

.cp-loader__bar-fill {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    height: 100%;
    width: 40%;
    background: var(--cp-primary);
    border-radius: var(--cp-radius-pill);
    animation: cpLoadingProgress 1.1s infinite var(--cp-ease-in-out);
}

@keyframes cpLoadingProgress {
    0% { inset-inline-start: -40%; width: 40%; }
    50% { width: 55%; }
    100% { inset-inline-start: 100%; width: 40%; }
}

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

/* ---- Toast ---- */
.cp-toast {
    position: fixed;
    bottom: calc(96px + var(--cp-safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(29, 29, 31, 0.92);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--cp-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--cp-shadow-md);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity var(--cp-transition-base), transform var(--cp-transition-base);
    pointer-events: none;
    max-width: min(90vw, 360px);
    border: none;
}

.cp-toast.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
    visibility: hidden;
}

:focus-visible {
    outline: 2px solid var(--cp-primary);
    outline-offset: 3px;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.is-hidden { display: none !important; }
