/* ============================================================================
   Local360Connect — Canonical Design Tokens
   Single source of truth for colors, type, spacing, radii, shadows, motion.
   Tailwind config in includes/tailwind_head.php references these via var(--token).
   ============================================================================ */

:root {
    /* ─── Brand ───────────────────────────────────────────────────────────── */
    --color-brand:        #0066CC;
    --color-brand-dark:   #004EA8;
    --color-brand-light:  #66A8E0;
    --color-brand-50:     #EBF3FB;
    --color-brand-100:    #C8DFF5;
    --color-brand-600:    #005BBF;
    --color-brand-900:    #002D5C;

    /* ─── Surface & Text (neutral scale) ──────────────────────────────────── */
    --color-bg:           #F5F5F7;
    --color-surface:      #FFFFFF;
    --color-text:         #1D1D1F;
    --color-text-sub:     #424245;
    --color-text-muted:   #86868B;
    --color-divider:      rgba(0,0,0,0.06);
    --color-border:       rgba(0,0,0,0.07);

    /* Neutral gray scale */
    --gray-50:            #F5F5F7;
    --gray-100:           #E8E8ED;
    --gray-200:           #C7C7CC;
    --gray-300:           #86868B;
    --gray-400:           #6E6E73;
    --gray-500:           #424245;

    /* ─── Status ──────────────────────────────────────────────────────────── */
    --color-success:      #34C759;
    --color-warning:      #FF9F0A;
    --color-error:        #FF3B30;
    --color-info:         #5AC8FA;

    /* Legacy aliases */
    --apple-bg:           var(--color-bg);
    --apple-surface:      var(--color-surface);
    --apple-text:         var(--color-text);
    --apple-text-sub:     var(--color-text-sub);
    --apple-text-muted:   var(--color-text-muted);
    --apple-divider:      var(--color-divider);
    --apple-blue:         var(--color-brand);
    --apple-blue-dark:    var(--color-brand-dark);
    --apple-red:          var(--color-error);
    --apple-green:        var(--color-success);
    --apple-orange:       var(--color-warning);

    /* ─── Glass ───────────────────────────────────────────────────────────── */
    --glass-light-bg:     rgba(255,255,255,0.72);
    --glass-light-border: rgba(255,255,255,0.5);
    --glass-dark-bg:      rgba(29,29,31,0.78);
    --glass-dark-border:  rgba(255,255,255,0.08);

    /* ─── Typography ──────────────────────────────────────────────────────── */
    --font-sans:          "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    --font-mono:          "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-sf:            var(--font-sans);

    /* Type scale per product brief */
    --text-hero:          3rem;       /* 48px  */
    --text-hero-lg:       3.5rem;     /* 56px  */
    --text-section:       2rem;       /* 32px  */
    --text-section-lg:    2rem;       /* 32px  */
    --text-card:          1.125rem;   /* 18px  */
    --text-card-lg:       1.125rem;   /* 18px  */
    --text-body:          0.9375rem;  /* 15px  */
    --text-body-lg:       1rem;       /* 16px  */
    --text-button:        1.01rem;    /* 16px  */
    --text-meta:          0.8125rem;  /* 13px  */
    --text-meta-lg:       0.8125rem;  /* 13px  */

    /* ─── Spacing scale (strictly: 8px, 16px, 24px, 32px, 48px, 64px) ──────── */
    --space-1:            8px;
    --space-2:            16px;
    --space-3:            24px;
    --space-4:            32px;
    --space-5:            48px;
    --space-6:            64px;
    /* Legacy/unused spacing variables fallback to keep existing code stable */
    --space-8:            32px;
    --space-12:           48px;
    --space-16:           64px;

    /* ─── Radii (strictly: 12px, 16px, 24px) ──────────────────────────────── */
    --radius-button:      12px;
    --radius-input:       12px;
    --radius-card:        16px;
    --radius-card-lg:     24px;
    --radius-hero:        24px;
    --radius-pill:        9999px;

    /* Backward compatibility mapping */
    --radius-sm:          8px;
    --radius-md:          12px;
    --radius-lg:          12px;
    --radius-xl:          12px;
    --radius-2xl:         16px;
    --radius-3xl:         24px;

    /* ─── Card tokens (used by .card / .apple-card / .card-sm/md/lg) ──────── */
    --card-radius:        var(--radius-card);
    --card-pad:           var(--space-2);    /* 16px */
    --card-pad-sm:        var(--space-1);    /* 8px  */
    --card-pad-lg:        var(--space-3);    /* 24px */
    --card-border:        var(--color-border);
    --card-shadow:        var(--shadow-soft);
    --card-shadow-hover:  var(--shadow-soft-hover);
    --card-duration:      200ms;

    /* ─── Shadows (subtle, unified soft shadow system) ────────────────────── */
    --shadow-soft:        0 4px 20px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.02);
    --shadow-soft-hover:  0 12px 32px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);

    /* Mappings to keep existing utilities resolved under the soft system */
    --shadow-xs:          0 1px 3px rgba(0,0,0,0.02);
    --shadow-sm:          var(--shadow-soft);
    --shadow-md:          var(--shadow-soft);
    --shadow-lg:          var(--shadow-soft-hover);
    --shadow-xl:          var(--shadow-soft-hover);
    --shadow-brand:       0 4px 12px rgba(0, 102, 204, 0.08);

    /* ─── Layout ──────────────────────────────────────────────────────────── */
    --site-max-width:     1280px;

    /* ─── Motion ──────────────────────────────────────────────────────────── */
    --ease-apple:         cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring:        cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-decel:         cubic-bezier(0, 0, 0.2, 1);
    --ease-accel:         cubic-bezier(0.4, 0, 1, 1);
    --duration-fast:      120ms;
    --duration-base:      200ms;
    --duration-slow:      300ms;
}

/* ============================================================================
   Typography utilities matching the product brief's hierarchy.
   Prefer these for new pages — they encode the canonical scale.
   ============================================================================ */

.text-hero    { font-size: var(--text-hero);    line-height: 1.1;  letter-spacing: -0.03em; font-weight: 800; }
.text-page    { font-size: var(--text-section); line-height: 1.2;  letter-spacing: -0.02em; font-weight: 700; }
.text-section { font-size: var(--text-section); line-height: 1.2;  letter-spacing: -0.02em; font-weight: 700; }
.text-card    { font-size: var(--text-card);    line-height: 1.3;  letter-spacing: -0.012em; font-weight: 600; }
.text-body    { font-size: var(--text-body);    line-height: 1.5;  letter-spacing: -0.005em; font-weight: 400; }
.text-meta    { font-size: var(--text-meta);    line-height: 1.4;  letter-spacing: 0;        font-weight: 500; color: var(--color-text-muted); }

@media (min-width: 768px) {
    .text-hero    { font-size: var(--text-hero-lg); }
    .text-page    { font-size: var(--text-section-lg); }
    .text-section { font-size: var(--text-section-lg); }
    .text-card    { font-size: var(--text-card-lg); }
    .text-body    { font-size: var(--text-body-lg); }
    .text-meta    { font-size: var(--text-meta-lg); }
}

/* ============================================================================
   Button system (Consolidated primary / secondary).
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1, 8px); /* 8px */
    height: 44px;
    padding: 0 var(--space-2, 16px); /* 16px */
    font-family: var(--font-sans);
    font-size: var(--text-button, 16px); /* 16px */
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: var(--radius-button, 12px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1)),
                color var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1)),
                border-color var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1)),
                transform var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1)),
                box-shadow var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1));
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
    appearance: none;
    -webkit-appearance: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Primary — main CTA */
.btn-v2-primary,
.btn-primary {
    background: var(--color-brand);
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.btn-v2-primary:hover,
.btn-primary:hover { background: var(--color-brand-dark); }

/* Secondary — paired with primary, neutral but emphasized */
.btn-v2-secondary,
.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    box-shadow: var(--shadow-xs);
}
.btn-v2-secondary:hover,
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-200); }

/* Ghost — minimal, inline, low emphasis */
.btn-v2-ghost {
    background: transparent;
    color: var(--color-text-sub);
}
.btn-v2-ghost:hover { background: var(--gray-100); color: var(--color-text); }

/* Icon — square, icon-only */
.btn-v2-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    color: var(--color-text-sub);
    border-radius: var(--radius-pill);
}
.btn-v2-icon:hover { background: var(--gray-100); color: var(--color-text); }

/* Destructive — irreversible actions */
.btn-v2-destructive {
    background: var(--color-error);
    color: #fff;
    box-shadow: 0 2px 8px -1px rgba(255,59,48,0.28);
}
.btn-v2-destructive:hover { background: #E0352B; }

/* Size modifiers (apply alongside any variant) */
.btn-sm { height: 36px; padding: 0 var(--space-2); font-size: var(--text-body); }
.btn-lg { height: 52px; padding: 0 var(--space-3); font-size: var(--text-body-lg); }
.btn-v2-icon.btn-sm { width: 36px; padding: 0; }
.btn-v2-icon.btn-lg { width: 52px; padding: 0; }

/* ============================================================================
   Form Controls (Inputs, Selects, Radios, Checkboxes)
   Consistent cross-browser Apple-style UI, overriding mobile browser defaults.
   ============================================================================ */

/* Class alias — some templates use `.apple-input` (intent: same as l360-input).
   Defining both names so neither pattern breaks the form layout. */
.apple-input,
/* Base Text Input & Textarea */
.l360-input {
    width: 100%;
    background-color: var(--color-surface, #ffffff);
    border: 1.5px solid var(--gray-100, #E8E8ED);
    border-radius: var(--radius-input, 12px);
    padding: 0.875rem 1rem;
    outline: none;
    font-family: var(--font-sans);
    font-size: var(--text-body, 15px);
    font-weight: 500;
    color: var(--color-text, #1D1D1F);
    transition: all var(--duration-fast, 120ms) var(--ease-apple, cubic-bezier(0.4, 0, 0.2, 1));
    appearance: none;
    -webkit-appearance: none;
}
.apple-input::placeholder,
.l360-input::placeholder { color: var(--gray-300); }
.apple-input:focus,
.l360-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.08);
}
.apple-input:disabled,
.l360-input:disabled {
    background-color: var(--gray-50);
    color: var(--gray-300);
    cursor: not-allowed;
}

/* ──────────────────────────────────────────────────────────────────────────
   SELECT / DROPDOWN  —  site-wide native override.
   Strategy: style every <select> by default so all browsers (iOS, Android,
   Windows, macOS) render the same way. Opt out by adding `.select-native`
   to any select that needs the native chrome (rare).

   Three selectors hit the same rules so existing templates that use
   `.apple-input`, `.l360-input` or `.l360-select` on a select all work.
   ────────────────────────────────────────────────────────────────────────── */
select:not(.select-native),
select.apple-input,
select.l360-input,
.l360-select {
    width: 100%;
    background-color: var(--color-surface, #ffffff);
    border: 1.5px solid var(--gray-100, #E8E8ED);
    border-radius: var(--radius-input, 12px);
    padding: 0.75rem 2.5rem 0.75rem 1rem;   /* extra right padding for the caret */
    outline: none;
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    transition: border-color var(--duration-fast) var(--ease-apple),
                box-shadow var(--duration-fast) var(--ease-apple);
    cursor: pointer;

    /* Kill the browser's native arrow so we can draw our own */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Chevron-down rendered as inline SVG (no extra HTTP request, no font dep) */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 16px;
}

select:not(.select-native):hover,
select.apple-input:hover,
select.l360-input:hover,
.l360-select:hover {
    border-color: var(--gray-200);
}

select:not(.select-native):focus,
select.apple-input:focus,
select.l360-input:focus,
.l360-select:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.08);
}

select:not(.select-native):disabled,
select.apple-input:disabled,
select.l360-input:disabled,
.l360-select:disabled {
    background-color: var(--gray-50);
    color: var(--gray-300);
    cursor: not-allowed;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C7C7CC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Size variants — pair with size utilities on the element */
select.select-sm,
select.l360-input.select-sm  { padding: 0.5rem 2.25rem 0.5rem 0.875rem; font-size: var(--text-meta-lg); background-position: right 0.7rem center; }
select.select-lg,
select.l360-input.select-lg  { padding: 1rem 2.75rem 1rem 1.125rem;     font-size: var(--text-body-lg); }

/* Multi-line / multiple selects shouldn't get the chevron */
select[multiple],
select[size]:not([size="1"]) {
    background-image: none !important;
    padding-right: 1rem !important;
    cursor: default;
}

/* Inside iOS Safari, the <option> elements always use system styling — we
   can't fully override that, but we can set sensible defaults. */
select option {
    background-color: var(--color-surface);
    color: var(--color-text);
    font-weight: 500;
}
select option:checked {
    background-color: var(--color-brand);
    color: #fff;
}

/* Custom Checkbox */
.l360-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-apple);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
}
.l360-checkbox:checked {
    background-color: var(--color-brand);
    border-color: var(--color-brand);
}
.l360-checkbox:checked::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
.l360-checkbox:focus-visible {
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
    outline: none;
}

/* Custom Radio */
.l360-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 50%;
    background-color: var(--color-surface);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-apple);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
}
.l360-radio:checked {
    border-color: var(--color-brand);
    border-width: 5px;
}
.l360-radio:focus-visible {
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2);
    outline: none;
}

/* Label Helper */
.l360-label {
    display: block;
    font-size: var(--text-meta-lg);
    font-weight: 600;
    color: var(--gray-300);
    margin-bottom: var(--space-2);
}

/* Language-specific overrides */
html[lang="te"] {
    --font-sans: "Noto Sans Telugu", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    --font-sf: var(--font-sans);
}

/* ============================================================================
   Micro-interactions, Shimmer Skeletons, and Bouncy Transitions
   ============================================================================ */

/* Global Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Tactile click scale feedback */
.active-scale,
.btn,
.apple-card,
.card-sm,
select:not(.select-native) {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color var(--duration-fast) var(--ease-apple), border-color var(--duration-fast) var(--ease-apple), box-shadow var(--duration-fast) var(--ease-apple);
}

.active-scale:active,
.btn:active,
.apple-card:active,
.card-sm:active {
    transform: scale(0.96) !important;
}

/* Premium Shimmer Sweep Animation */
@keyframes shimmerSweep {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(90deg, #f5f5f7 25%, #e8e8ed 50%, #f5f5f7 75%);
    background-size: 200% 100%;
    animation: shimmerSweep 1.5s infinite linear;
    border-radius: var(--radius-card, 16px);
    display: inline-block;
}

/* Bouncy spring bookmark pop */
@keyframes bookmarkPop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

.animate-bookmark-pop {
    animation: bookmarkPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* ══ Accessibility keyboard focus indicators ══ */
*:focus-visible {
    outline: 2px solid var(--color-brand) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15) !important;
}


