/* ══════════════════════════════════════════════════════
   CHECKOUT DESIGN SYSTEM v2.0
   Passeios Florianópolis — Shared CSS
   Brad Frost (tokens + structure) + Manu Arora (motion)
   ══════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
    /* Colors */
    --c-black: #111111;
    --c-white: #ffffff;
    --c-accent: #0ea5e9;
    --c-accent-dark: #0284c7;
    --c-green: #16a34a;
    --c-red: #ef4444;
    --c-red-bg: #fef2f2;
    --c-red-border: #fecaca;

    /* Grays */
    --c-gray-50: #f9fafb;
    --c-gray-100: #f3f4f6;
    --c-gray-200: #e5e7eb;
    --c-gray-300: #d1d5db;
    --c-gray-400: #9ca3af;
    --c-gray-500: #6b7280;
    --c-gray-600: #4b5563;
    --c-gray-700: #374151;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --s-xs: 4px;
    --s-sm: 8px;
    --s-md: 16px;
    --s-lg: 24px;
    --s-xl: 32px;
    --s-2xl: 48px;

    /* Radius */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 50px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);

    /* Motion */
    --ease: cubic-bezier(0.25, 1, 0.5, 1);
    --duration-fast: 0.15s;
    --duration: 0.25s;
    --duration-slow: 0.4s;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--c-gray-50);
    color: var(--c-black);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    line-height: 1.5;
}

/* ── LAYOUT ── */
.page-wrapper {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 var(--s-md);
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-md);
}

/* ── PROGRESS BAR GLOBAL ── */
.progress-global {
    position: sticky; top: 0; z-index: 200;
    background: var(--c-white);
    border-bottom: 1px solid var(--c-gray-100);
    padding: 10px var(--s-md);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}

.progress-step {
    display: flex; align-items: center; gap: 6px;
}

.progress-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 800;
    border: 2px solid var(--c-gray-200);
    color: var(--c-gray-400);
    background: var(--c-white);
    transition: all var(--duration) var(--ease);
}

.progress-dot.active {
    background: var(--c-black);
    border-color: var(--c-black);
    color: var(--c-white);
}

.progress-dot.done {
    background: var(--c-green);
    border-color: var(--c-green);
    color: var(--c-white);
}

.progress-line {
    width: 24px; height: 2px;
    background: var(--c-gray-200);
    border-radius: 1px;
    transition: background var(--duration);
}

.progress-line.done { background: var(--c-green); }

/* ── TIMER ── */
.timer-bar {
    background: var(--c-black); color: var(--c-white);
    font-size: 0.72rem; font-weight: 600;
    padding: 8px var(--s-md); text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    letter-spacing: 0.3px;
}

.timer-bar i { opacity: 0.6; }

.timer-val {
    color: var(--c-accent);
    font-family: var(--font);
    font-size: 0.85rem; font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 42px; display: inline-block;
}

.timer-val.expired { color: var(--c-red); }

/* ── CARDS ── */
.card {
    background: var(--c-white);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    padding: var(--s-lg);
    animation: slideUp var(--duration-slow) var(--ease);
}

.card + .card { margin-top: var(--s-md); }

.card-header {
    background: var(--c-gray-50);
    padding: var(--s-lg);
    border-bottom: 1px solid var(--c-gray-100);
    text-align: center;
    margin: calc(-1 * var(--s-lg)) calc(-1 * var(--s-lg)) var(--s-lg);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; cursor: pointer;
    font-family: var(--font);
    font-weight: 800;
    transition: all var(--duration) var(--ease);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

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

.btn-primary {
    background: var(--c-black); color: var(--c-white);
    padding: 16px 28px; border-radius: var(--r-md);
    font-size: 1rem; width: 100%;
    text-transform: uppercase; letter-spacing: 0.3px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active { transform: scale(0.98); }

.btn-primary:focus-visible {
    outline: 3px solid var(--c-accent);
    outline-offset: 2px;
}

.btn-primary i {
    font-size: 0.8em;
    transition: transform var(--duration);
}

.btn-primary:hover i { transform: translateX(3px); }

.btn-secondary {
    background: var(--c-gray-100); color: var(--c-black);
    padding: 14px 20px; border-radius: var(--r-md);
    font-size: 0.9rem; width: 100%;
    border: 1px solid var(--c-gray-200);
}

.btn-secondary:hover { background: var(--c-gray-200); }

/* ── INPUTS ── */
.input-group { margin-bottom: var(--s-md); text-align: left; }

.input-label {
    display: block;
    font-size: 0.65rem; font-weight: 700;
    color: var(--c-gray-500);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 6px; padding-left: 2px;
}

.input-field {
    width: 100%; padding: 16px;
    border: 2px solid var(--c-gray-200);
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 1rem; font-weight: 600;
    text-align: center; outline: none;
    background: var(--c-white);
    transition: border-color var(--duration), box-shadow var(--duration);
}

.input-field:focus {
    border-color: var(--c-black);
    box-shadow: 0 0 0 3px rgba(17,17,17,0.08);
}

.input-field::placeholder { color: var(--c-gray-300); font-weight: 400; }

.input-field.error {
    border-color: var(--c-red);
    animation: shake 0.4s var(--ease);
}

.input-error {
    font-size: 0.72rem; color: var(--c-red);
    font-weight: 600; margin-top: 4px;
    padding-left: 2px;
    display: none;
}

.input-error.visible { display: block; }

/* ── SECTION TITLES ── */
.section-title {
    font-size: 0.65rem; font-weight: 700;
    color: var(--c-gray-400);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* ── BADGES ── */
.step-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--c-gray-100); color: var(--c-gray-500);
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 5px 12px; border-radius: var(--r-pill);
}

.tag {
    font-size: 0.5rem; font-weight: 800;
    padding: 2px 6px; border-radius: 4px;
    letter-spacing: 0.3px;
    display: inline-block;
}

.tag-dark { background: var(--c-black); color: var(--c-white); }
.tag-accent { background: var(--c-accent); color: var(--c-white); }

/* ── FOOTER (sticky CTA) ── */
.footer-sticky {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.06);
    padding: 14px var(--s-md);
    z-index: 100;
    transform: translateY(100%);
    transition: transform var(--duration-slow) var(--ease);
}

.footer-sticky.visible { transform: translateY(0); }

.footer-inner {
    max-width: 520px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
}

/* ── WHATSAPP FLOAT ── */
.wa-float {
    position: fixed; bottom: 20px; right: 16px;
    background: #25d366; color: var(--c-white);
    width: 48px; height: 48px; border-radius: 50%;
    box-shadow: 0 4px 15px rgba(37,211,102,0.35);
    z-index: 90;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: all var(--duration) var(--ease);
}

.wa-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37,211,102,0.45);
    color: var(--c-white);
}

.wa-float i { font-size: 1.4rem; }

.has-footer .wa-float { bottom: 90px; }

/* ── TOAST ── */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--c-black); color: var(--c-white);
    padding: 12px 24px; border-radius: var(--r-pill);
    font-size: 0.85rem; font-weight: 600;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s var(--ease);
    pointer-events: none;
    display: flex; align-items: center; gap: 8px;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: var(--c-green); }
.toast.error { background: var(--c-red); }

/* ── LOADER ── */
.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
}

.loader-overlay.visible { display: flex; }

.loader-text {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--c-gray-500);
}

/* ── ANIMATIONS ── */
@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

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

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── RESPONSIVE ── */
@media (max-width: 400px) {
    :root {
        --s-lg: 20px;
        --s-md: 14px;
    }

    .btn-primary { padding: 14px 22px; font-size: 0.9rem; }
    .card { padding: var(--s-lg); }
}

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-muted { color: var(--c-gray-500); }
.text-accent { color: var(--c-accent); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.72rem; }
.font-black { font-weight: 900; }
.mt-sm { margin-top: var(--s-sm); }
.mt-md { margin-top: var(--s-md); }
.mt-lg { margin-top: var(--s-lg); }
.mb-sm { margin-bottom: var(--s-sm); }
.mb-md { margin-bottom: var(--s-md); }
.mb-lg { margin-bottom: var(--s-lg); }
.hidden { display: none !important; }
