/* ============================================
   JCFlow — Layout Design System
   Base CSS: variables, reset, layout, components
   ============================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* --- Colors: Light Theme (default inherits from data-theme) --- */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f6fb;
    --bg-tertiary: #e9ecf5;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fd;
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-primary: #101828;
    --text-secondary: #475467;
    --text-tertiary: #98a2b3;
    --text-inverse: #ffffff;

    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: rgba(79, 70, 229, 0.12);
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --border: #e5e7eb;
    --border-hover: #d1d5db;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.3);

    /* --- Typography --- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;
    --text-6xl: 3.75rem;
    --text-7xl: 4.5rem;

    --leading-tight: 1.15;
    --leading-snug: 1.3;
    --leading-normal: 1.6;

    --weight-light: 300;
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --weight-extrabold: 800;

    /* --- Spacing --- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* --- Borders --- */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* --- Transitions --- */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-theme: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* --- Z-index --- */
    --z-base: 1;
    --z-nav: 100;
    --z-modal: 200;
    --z-toast: 300;

    /* --- Layout Offsets & Header Dimensions --- */
    --header-height: 76px;
    --header-offset: calc(var(--header-height) + 32px);

    /* --- Container --- */
    --container-max: 1200px;
    --container-padding: var(--space-6);
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
    --bg-primary: #07080f;
    --bg-secondary: #0f1119;
    --bg-tertiary: #161825;
    --bg-card: #12141f;
    --bg-card-hover: #1a1d2e;
    --bg-glass: rgba(12, 14, 25, 0.8);

    --text-primary: #f0f1f5;
    --text-secondary: #a1a7b8;
    --text-tertiary: #636b80;
    --text-inverse: #07080f;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.15);

    --border: #1e2235;
    --border-hover: #2d3350;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.25);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-height, 76px) + 28px);
    overflow-x: hidden;
}

.scroll-anchor-alias,
.calc-anchor-alias {
    display: block;
    position: relative;
    top: 0;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    visibility: hidden;
    pointer-events: none;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color var(--transition-theme), color var(--transition-theme);
}

img, video, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

ul, ol {
    list-style: none;
}

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

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

::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- LAYOUT ---------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.section {
    padding: var(--space-24) 0;
    position: relative;
}

.section--alt {
    background-color: var(--bg-secondary);
}

/* ---------- GRID ---------- */
.grid {
    display: grid;
    gap: var(--space-8);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid--2, .grid--3, .grid--4 {
        grid-template-columns: 1fr;
    }

    .section {
        padding: var(--space-16) 0;
    }

    :root {
        --container-padding: var(--space-4);
        --header-height: 70px;
    }
}

/* ---------- TYPOGRAPHY ---------- */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-4);
    padding: var(--space-1) var(--space-4);
    background: var(--accent-light);
    border-radius: var(--radius-full);
}

.section-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-extrabold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    line-height: var(--leading-normal);
}

.text-center {
    text-align: center;
}

.text-center .section-subtitle {
    margin: 0 auto;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .section-title {
        font-size: var(--text-3xl);
    }
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn--primary {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-md), 0 0 20px rgba(79, 70, 229, 0.2);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(79, 70, 229, 0.35);
    color: #ffffff;
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--outline {
    border: 2px solid var(--border);
    color: var(--text-primary);
    background: transparent;
}

.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.btn--ghost {
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
}

.btn--ghost:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.btn--lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-xl);
}

/* Button shimmer effect */
.btn--primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}

.btn--primary:hover::after {
    left: 125%;
}

/* ---------- CARDS ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.card--glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ---------- BADGES ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
}

.badge--popular {
    background: var(--accent-gradient);
    color: #ffffff;
}

/* ---------- SCROLL REVEAL ANIMATIONS ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger children */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-stagger.revealed > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.revealed > *:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger.revealed > *:nth-child(3) { transition-delay: 0.15s; }
.reveal-stagger.revealed > *:nth-child(4) { transition-delay: 0.2s; }
.reveal-stagger.revealed > *:nth-child(5) { transition-delay: 0.25s; }
.reveal-stagger.revealed > *:nth-child(6) { transition-delay: 0.3s; }
.reveal-stagger.revealed > *:nth-child(7) { transition-delay: 0.35s; }
.reveal-stagger.revealed > *:nth-child(8) { transition-delay: 0.4s; }

.reveal-stagger.revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   Global Floating WhatsApp Button
   ========================================== */
.wa-float {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.45), 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.wa-float:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 16px 40px rgba(37, 211, 102, 0.6), 0 6px 16px rgba(0, 0, 0, 0.3);
}

.wa-float:active {
    transform: translateY(-1px) scale(1.02);
}

.wa-float__icon {
    width: 30px;
    height: 30px;
    fill: #ffffff;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.wa-float:hover .wa-float__icon {
    transform: rotate(-8deg) scale(1.08);
}

.wa-float__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.55);
    animation: waFloatPulse 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
}

@keyframes waFloatPulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

.wa-float__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.wa-float__tooltip {
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    background: rgba(16, 24, 40, 0.95);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wa-float:hover .wa-float__tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 767.98px) {
    /* En móvil ocultamos el botón circular flotante y activamos la Thumb-Zone Bar */
    .wa-float {
        display: none !important;
    }
    .wa-float__tooltip {
        display: none;
    }

    body {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    /* Prevenir zoom no deseado en iOS Safari al enfocar inputs (CLS = 0) */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ============================================
   JCFlow — Mobile Thumb-Zone Conversion Bar
   ============================================ */
.thumb-bar {
    display: none;
}

@media (max-width: 767.98px) {
    .thumb-bar {
        display: flex;
        flex-direction: column;
        gap: 5px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9980;
        background: rgba(11, 15, 25, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(99, 102, 241, 0.28);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(255, 255, 255, 0.05);
        padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
        transform: translateY(115%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
        box-sizing: border-box;
    }

    .thumb-bar.thumb-bar--visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    /* Micro-ticker de prueba social */
    .thumb-bar__ticker {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 0.72rem;
        font-weight: 600;
        color: #a5b4fc;
        padding: 0 4px;
        letter-spacing: 0.2px;
        user-select: none;
        -webkit-user-select: none;
    }

    .thumb-bar__ticker-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #22c55e;
        box-shadow: 0 0 6px #22c55e;
        flex-shrink: 0;
        animation: thumbBarDotPulse 1.8s infinite;
    }

    @keyframes thumbBarDotPulse {
        0% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.35); opacity: 0.6; }
        100% { transform: scale(1); opacity: 1; }
    }

    .thumb-bar__ticker-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    /* Acciones en la Zona del Pulgar */
    .thumb-bar__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

    .thumb-bar__btn {
        min-height: 48px;
        height: 48px;
        border-radius: 12px;
        font-size: 0.92rem;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        text-decoration: none;
        border: none;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.12s ease, filter 0.12s ease;
        box-sizing: border-box;
    }

    .thumb-bar__btn:active {
        transform: scale(0.96);
        filter: brightness(1.1);
    }

    .thumb-bar__btn--wa {
        background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
        color: #ffffff !important;
        box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
    }

    .thumb-bar__btn--trial {
        background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
        color: #ffffff !important;
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    }

    .thumb-bar__icon {
        width: 20px;
        height: 20px;
        fill: #ffffff;
        flex-shrink: 0;
    }

    .thumb-bar__trial-icon {
        font-size: 1rem;
        line-height: 1;
        flex-shrink: 0;
    }
}

