/* VoucherGratis UI/UX Foundation v2 — Patch 016
 * Source of truth: VoucherGratis_UI_UX_REVAMP_MASTER_CONTEXT_v1.md
 * Foundation only. Module-specific redesign belongs to Patch 018+.
 */

:root {
    color-scheme: light dark;

    /* Brand */
    --vg-orange-50: #FFF7ED;
    --vg-orange-100: #FFEDD5;
    --vg-orange-200: #FED7AA;
    --vg-orange-300: #FDBA74;
    --vg-orange-400: #FB8733;
    --vg-orange-500: #F45A07;
    --vg-orange-600: #D94A00;
    --vg-orange-700: #B83D00;
    --vg-orange-800: #91320A;
    --vg-orange-900: #70280C;

    --vg-primary: var(--vg-orange-500);
    --vg-primary-hover: var(--vg-orange-600);
    --vg-primary-pressed: var(--vg-orange-700);
    --vg-primary-soft: var(--vg-orange-50);
    --vg-brand-navy: #04184D;

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

    /* Semantic */
    --vg-success: #16A34A;
    --vg-success-soft: #F0FDF4;
    --vg-warning: #D97706;
    --vg-warning-soft: #FFFBEB;
    --vg-danger: #DC2626;
    --vg-danger-soft: #FEF2F2;
    --vg-info: #2563EB;
    --vg-info-soft: #EFF6FF;

    /* Light surfaces */
    --vg-bg: var(--vg-slate-50);
    --vg-surface: #FFFFFF;
    --vg-surface-raised: #FFFFFF;
    --vg-surface-subtle: var(--vg-slate-50);
    --vg-text-primary: var(--vg-slate-900);
    --vg-text-secondary: var(--vg-slate-600);
    --vg-text-muted: var(--vg-slate-500);
    --vg-text-disabled: var(--vg-slate-400);
    --vg-border: var(--vg-slate-200);
    --vg-border-strong: var(--vg-slate-300);
    --vg-focus: rgba(244, 90, 7, .14);

    /* Typography */
    --vg-font-sans: "Plus Jakarta Sans", Arial, ui-sans-serif, system-ui, sans-serif;
    --vg-font-size-body: 14px;
    --vg-line-body: 1.5;
    --vg-font-size-label: 13px;
    --vg-font-size-caption: 12px;
    --vg-font-size-page-title: clamp(28px, 2.2vw, 32px);
    --vg-font-size-section-title: clamp(20px, 1.7vw, 24px);
    --vg-font-size-card-title: 16px;
    --vg-font-size-kpi: clamp(28px, 2.4vw, 32px);

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

    /* Radius */
    --vg-radius-badge: 6px;
    --vg-radius-control: 8px;
    --vg-radius-dropdown: 10px;
    --vg-radius-table: 10px;
    --vg-radius-card: 12px;
    --vg-radius-panel: 16px;
    --vg-radius-modal: 16px;
    --vg-radius-sheet: 22px;
    --vg-radius-pill: 999px;

    /* Control density */
    --vg-control-h: 40px;
    --vg-control-h-mobile: 44px;
    --vg-control-padding-x: 12px;
    --vg-table-row-h: 50px;

    /* Shadows */
    --vg-shadow-card: 0 1px 3px rgba(15, 23, 42, .08);
    --vg-shadow-elevated: 0 8px 24px rgba(15, 23, 42, .10);
    --vg-shadow-modal: 0 20px 40px rgba(2, 6, 23, .18);

    /* Motion */
    --vg-duration-fast: 120ms;
    --vg-duration-normal: 160ms;
    --vg-ease-standard: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="light"] {
    color-scheme: light;
    --vg-bg: var(--vg-slate-50);
    --vg-surface: #FFFFFF;
    --vg-surface-raised: #FFFFFF;
    --vg-surface-subtle: var(--vg-slate-50);
    --vg-text-primary: var(--vg-slate-900);
    --vg-text-secondary: var(--vg-slate-600);
    --vg-text-muted: var(--vg-slate-500);
    --vg-text-disabled: var(--vg-slate-400);
    --vg-border: var(--vg-slate-200);
    --vg-border-strong: var(--vg-slate-300);
}

[data-theme="dark"] {
    color-scheme: dark;
    --vg-bg: #080E1C;
    --vg-surface: #0F172A;
    --vg-surface-raised: #182235;
    --vg-surface-subtle: #111B2D;
    --vg-text-primary: #F8FAFC;
    --vg-text-secondary: #CBD5E1;
    --vg-text-muted: #94A3B8;
    --vg-text-disabled: #64748B;
    --vg-border: #263449;
    --vg-border-strong: #3A4A62;
    --vg-primary-soft: rgba(244, 90, 7, .12);
    --vg-success-soft: rgba(22, 163, 74, .12);
    --vg-warning-soft: rgba(217, 119, 6, .12);
    --vg-danger-soft: rgba(220, 38, 38, .12);
    --vg-info-soft: rgba(37, 99, 235, .12);
}

html {
    font-family: var(--vg-font-sans);
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
}

body.vg-body,
body.vg-public-body {
    font-family: var(--vg-font-sans);
    font-size: var(--vg-font-size-body);
    line-height: var(--vg-line-body);
    letter-spacing: -.005em;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.vg-page-header h2,
.vg-topbar h1,
.vg-auth__header h1,
.vg-public-content h1 {
    letter-spacing: -.025em;
}

.vg-page-header h2 {
    font-size: var(--vg-font-size-page-title);
    line-height: 1.2;
    font-weight: 700;
}

.vg-section-card h3,
.vg-summary-card h3 {
    font-size: var(--vg-font-size-card-title);
    font-weight: 600;
}

.vg-field__label,
.vg-msg-field label {
    font-size: var(--vg-font-size-label);
    font-weight: 600;
}

.vg-field__help,
.vg-field__error,
.vg-msg-hint,
.vg-msg-error {
    font-size: var(--vg-font-size-caption);
}

.vg-metric-card strong,
.vg-dr-kpi strong,
.vg-aa-stat strong {
    font-variant-numeric: tabular-nums;
}

/* Compact Enterprise control system */
.vg-input,
.vg-msg-input,
.vg-msg-select {
    height: var(--vg-control-h);
    min-height: var(--vg-control-h);
    border-radius: var(--vg-radius-control);
    padding: 0 var(--vg-control-padding-x);
    font-size: 14px;
    line-height: 1.2;
}

select.vg-input,
.vg-msg-select {
    padding-right: 34px;
}

.vg-textarea,
textarea.vg-input {
    height: auto;
    min-height: 96px;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.5;
    resize: vertical;
}

.vg-button,
.vg-msg-btn {
    height: var(--vg-control-h);
    min-height: var(--vg-control-h);
    border-radius: var(--vg-radius-control);
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.vg-button--compact {
    height: 36px;
    min-height: 36px;
    padding-inline: 12px;
}

.vg-input:focus,
.vg-msg-input:focus,
.vg-msg-select:focus {
    border-color: var(--vg-primary);
    box-shadow: 0 0 0 3px var(--vg-focus);
    outline: none;
}

.vg-button--primary {
    background: var(--vg-primary);
    color: #FFFFFF;
}

.vg-button--primary:hover {
    background: var(--vg-primary-hover);
}

.vg-button--primary:active {
    background: var(--vg-primary-pressed);
}

.vg-button--secondary {
    border-color: var(--vg-border-strong);
}

.vg-button:focus-visible,
.vg-input:focus-visible,
.vg-msg-input:focus-visible,
.vg-msg-select:focus-visible,
.vg-icon-button:focus-visible {
    outline: 3px solid var(--vg-focus);
    outline-offset: 2px;
}

/* SVG-only UI icon foundation */
.vg-app-icon,
.vg-ui-icon {
    display: block;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.vg-icon-button,
.vg-modal__close,
.vg-toast__close,
.vg-mobile-filter-sheet__close {
    width: var(--vg-control-h);
    height: var(--vg-control-h);
    min-width: var(--vg-control-h);
    min-height: var(--vg-control-h);
    display: inline-grid;
    place-items: center;
    border-radius: var(--vg-radius-control);
    padding: 0;
}

.vg-toast__indicator {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: var(--vg-radius-pill);
    background: transparent !important;
}

.vg-toast--success .vg-toast__indicator { color: var(--vg-success); }
.vg-toast--warning .vg-toast__indicator { color: var(--vg-warning); }
.vg-toast--error .vg-toast__indicator { color: var(--vg-danger); }
.vg-toast--info .vg-toast__indicator { color: var(--vg-info); }

.vg-empty-state__icon,
.vg-redeem-result__icon {
    display: grid;
    place-items: center;
}

.vg-empty-state__icon .vg-app-icon,
.vg-redeem-result__icon .vg-app-icon {
    width: 24px;
    height: 24px;
}

.vg-mobile-menu-link > .vg-app-icon:last-child {
    color: var(--vg-text-muted);
}

/* Surface rhythm: foundation only, not a module redesign. */
.vg-metric-card,
.vg-section-card {
    border-radius: var(--vg-radius-card);
    box-shadow: none;
}

.vg-table-wrap {
    border-radius: var(--vg-radius-table);
}

.vg-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.vg-table td {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.vg-modal__panel {
    border-radius: var(--vg-radius-modal);
    box-shadow: var(--vg-shadow-modal);
}

/* Accessibility utilities for future shared components. */
.vg-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.vg-tabular-nums {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
    :root {
        --vg-control-h: var(--vg-control-h-mobile);
    }

    .vg-input,
    .vg-msg-input,
    .vg-msg-select,
    .vg-button,
    .vg-msg-btn,
    .vg-button--compact {
        height: var(--vg-control-h-mobile);
        min-height: var(--vg-control-h-mobile);
    }

    .vg-textarea,
    textarea.vg-input {
        height: auto;
        min-height: 112px;
    }

    .vg-icon-button,
    .vg-modal__close,
    .vg-toast__close,
    .vg-mobile-filter-sheet__close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .vg-filter-bar[data-mobile-filter-ready="true"] .vg-input,
    .vg-filter-bar[data-mobile-filter-ready="true"] select,
    .vg-filter-bar[data-mobile-filter-ready="true"] .vg-button {
        min-height: 44px;
        height: 44px;
    }
}

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