/* ============================================================
   Unified Waiver — Mobile-First Design System
   Playhem Entertainment Group
   ============================================================ */

:root {
    --bg-page: #0a0e1a;
    --bg-surface: #111827;
    --bg-elevated: #1e293b;
    --bg-input: #0f172a;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.15);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e3a5f;
    --border-subtle: rgba(59, 130, 246, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Waiver Container ---- */
.waiver-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---- Brand Header ---- */
.brand-header {
    text-align: center;
    padding: 16px 0 8px;
    flex-shrink: 0;
}
.brand-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.brand-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ---- Progress Dots ---- */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 0 24px;
    flex-shrink: 0;
}
.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    transition: all 0.3s ease;
}
.progress-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.2);
}
.progress-dot.completed {
    background: var(--accent);
    border-color: var(--accent);
    opacity: 0.5;
}

/* ---- Steps Viewport ---- */
.steps-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}
.steps-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}
.step {
    min-width: 100%;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.step.active {
    opacity: 1;
}

/* ---- Step Content ---- */
.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.step-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ---- Form Elements ---- */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.form-input::placeholder {
    color: var(--text-muted);
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}
.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}
.form-error.visible {
    display: block;
}
.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}
.form-hint strong {
    color: var(--text-secondary);
}
.form-group.hidden {
    display: none;
}

/* Date input fix for dark theme */
.form-input[type="date"] {
    color-scheme: dark;
}

/* ---- Pill Selectors ---- */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}
.pill {
    padding: 10px 18px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
}
.pill:active {
    transform: scale(0.96);
}
.pill.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.pill-group.multi .pill.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
    -webkit-appearance: none;
    width: 100%;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-primary:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.btn-back {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 10px 16px;
    width: auto;
}
.btn-back:hover {
    color: var(--text-secondary);
}

/* Button row — pinned at bottom via flex */
.step-buttons {
    margin-top: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(to bottom, transparent, var(--bg-page) 12px);
    padding: 24px 0 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 10;
}

/* Loading spinner in button */
.btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { display: none; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Checkbox ---- */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    display: none;
}
.checkbox-box {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.checkbox-row input:checked + .checkbox-box {
    background: var(--accent);
    border-color: var(--accent);
}
.checkbox-row input:checked + .checkbox-box::after {
    content: '';
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}
.checkbox-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ---- Terms & Conditions ---- */
.terms-scroll {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
.terms-scroll h3 {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin: 16px 0 8px;
}
.terms-scroll h3:first-child {
    margin-top: 0;
}
.terms-scroll p {
    margin-bottom: 8px;
}
.terms-scroll::-webkit-scrollbar {
    width: 6px;
}
.terms-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.terms-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ---- Dependants ---- */
.dependant-entry {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}
.dependant-entry .form-input {
    flex: 1;
    min-width: 0;
}
.btn-remove-dependant {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    background: var(--danger-soft);
    color: var(--danger);
    border: none;
    border-radius: var(--radius);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.btn-add-dependant {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 4px;
}
.btn-add-dependant:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Escape Count Exact Input ---- */
.escape-exact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}
.escape-exact-row span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.escape-exact-row .form-input {
    width: 80px;
    text-align: center;
    padding: 8px 12px;
}

.waiver-container--selector {
    overflow-y: auto;
    padding-bottom: 40px;
}

/* ---- Brand Selector (no brand param) ---- */
.brand-selector {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 40px 0;
}
.brand-card {
    display: block;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
}
.brand-card:visited {
    color: inherit;
}
.brand-card:hover, .brand-card:active {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: inherit;
    text-decoration: none;
}
.brand-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.brand-logo {
    display: block;
    max-width: 160px;
    max-height: 60px;
    margin: 0 auto 16px;
    object-fit: contain;
}
.brand-logo-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.brand-logo-half {
    max-width: 100px;
    max-height: 50px;
    margin: 0;
}

/* ---- Mobile Prefix Input ---- */
.mobile-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
}
.mobile-prefix {
    padding: 12px 5px 10px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    user-select: none;
}
.mobile-input {
    border-radius: 0 var(--radius) var(--radius) 0 !important;
}
.mobile-input-wrap .form-input:focus ~ .mobile-prefix,
.mobile-input-wrap:focus-within .mobile-prefix {
    border-color: var(--accent);
}

/* ---- Player ID Card (confirmation screen) ---- */
.player-id-card {
    background: var(--bg-elevated);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 24px 0 8px;
    text-align: center;
}
.player-id-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 8px;
}
.player-id-number {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.player-id-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    margin-bottom: 0;
    line-height: 1.4;
}

/* ---- Confirmation Screen ---- */
.confirmation {
    text-align: center;
    padding: 40px 0;
}
.confirmation .check-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--success-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}
.confirmation .check-circle svg {
    width: 36px;
    height: 36px;
    color: var(--success);
}
.confirmation h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.confirmation p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.confirmation .reset-countdown {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Kiosk Indicator ---- */
.kiosk-badge {
    position: fixed;
    bottom: 8px;
    right: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.4;
    z-index: 100;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
    .waiver-container {
        padding: 32px 24px 48px;
    }
    .brand-header h1 {
        font-size: 1.75rem;
    }
    .pill-group {
        gap: 12px;
    }
    .pill {
        padding: 12px 22px;
    }
    .terms-scroll {
        max-height: 400px;
    }
    .brand-card {
        padding: 32px 24px;
    }
}
