:root {
    /* Design System Tokens (Stitch - Tamo Meridian) */
    --color-primary: #000102;
    --color-primary-container: #181c22;
    --color-secondary: #0040e0;
    --color-secondary-container: #2e5bff;
    --color-tertiary: #b7f569;
    --color-tertiary-on: #102000;
    --color-surface: #f7f9fb;
    --color-surface-lowest: #ffffff;
    --color-surface-container: #eceef0;
    --color-surface-container-low: #f2f4f6;
    --color-on-surface: #191c1e;
    --color-on-surface-variant: #44474a;
    --color-outline: #c5c6ca;
    
    --color-error: #ba1a1a;
    --color-error-on: #ffffff;
    
    --font-heading: 'Manrope', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --spacing-2: 0.5rem;   /* 8px */
    --spacing-4: 1rem;     /* 16px */
    --spacing-8: 2rem;     /* 32px */
    --spacing-12: 3rem;    /* 48px */
    --spacing-16: 4rem;    /* 64px */

    --radius-full: 9999px;
    --radius-xl: 0.75rem;

    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-surface);
    color: var(--color-on-surface);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
.display-lg { font-family: var(--font-heading); font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; line-height: 1.1; letter-spacing: -1px; }
.headline-md { font-family: var(--font-heading); font-size: clamp(1.2rem, 5vw, 1.75rem); font-weight: 700; }
.body-md { font-size: 0.875rem; }
.body-sm { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;}
.text-surface-variant { color: var(--color-on-surface-variant); }

/* Spacing */
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: var(--spacing-8); }
.mt-12 { margin-top: var(--spacing-12); }
.p-4 { padding: var(--spacing-4); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}
.btn-block { width: 100%; }
.rounded-full { border-radius: var(--radius-full); }

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-container));
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-primary:active { transform: scale(0.98); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.btn-primary:hover, .btn-secondary:hover { filter: brightness(1.2); transform: translateY(-2px); }

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

.btn-icon {
    background: none; border: none; padding: 0.5rem; cursor: pointer; color: var(--color-on-surface);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
}
.input-group label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    margin-bottom: 0.3rem;
}
.input-group input, .input-group select, .input-group textarea {
    background-color: var(--color-surface-container);
    border: none;
    border-bottom: 2px solid var(--color-outline);
    padding: 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border-radius: 4px 4px 0 0;
    color: var(--color-on-surface);
    transition: var(--transition);
    width: 100%;
}
.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-bottom-color: var(--color-secondary);
    background-color: var(--color-surface-container-low);
}

/* Layouts & Views */
.view {
    display: none;
    padding: var(--spacing-8) var(--spacing-4);
    min-height: 100vh;
    animation: fadeIn 0.4s ease forwards;
}
.view.active {
    display: block;
}

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

/* Modals */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    z-index: 1000; display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: var(--color-surface); border-radius: 20px;
    width: 90%; max-width: 500px; padding: var(--spacing-4);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: popModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes popModal {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Badge Anim */
@keyframes pingBadge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
.global-bell-badge { animation: pingBadge 1s infinite alternate ease-in-out; }

.glass-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 1rem var(--spacing-4);
    background: rgba(247, 249, 251, 0.85);
    backdrop-filter: blur(20px);
    z-index: 100;
}
.logo { font-family: var(--font-heading); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.5px; }

.landing-content { margin-top: 4rem; }

/* SVG FLow animation */
.flow-animation { position: relative; width: 100%; height: 120px; }
.flow-svg { width: 100%; height: 100%; }
.bg-primary { fill: var(--color-primary); }
.bg-secondary { fill: var(--color-secondary); }
.bg-tertiary { fill: var(--color-tertiary); }
.svg-path { stroke: var(--color-outline); stroke-width: 2; stroke-dasharray: 5,5; animation: dash 5s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -100; } }
.flow-labels { display: flex; justify-content: space-between; padding: 0 10%; margin-top: -10px; font-weight: 600; font-size: 0.75rem; color: var(--color-on-surface-variant); }

/* Toasts */
#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px;}
.toast {
    padding: 1rem 1.5rem; border-radius: var(--radius-xl); font-weight: 600;
    background: var(--color-on-surface); color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease forwards;
}
.toast.success { background: var(--color-tertiary); color: var(--color-tertiary-on); }
.toast.error { background: #ba1a1a; color: #fff; }

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

/* Utils */
.hidden { display: none !important; }
.text-center { text-align: center; }
.cursor-pointer { cursor: pointer; }

/* PWA FAB */
.pwa-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-container));
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-full);
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    cursor: pointer;
    z-index: 1000;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.pwa-fab:active { transform: scale(0.95); }

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseYoutube {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 0, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

.youtube-fab {
    position: fixed;
    bottom: 25px;
    left: 20px;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #FF0000, #cc0000);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(255, 0, 0, 0.4);
    z-index: 2000; /* Prioridad máxima por encima de casi todo */
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, pulseYoutube 3s infinite ease-in-out;
}

.youtube-fab:hover {
    transform: scale(1.1) translateY(-3px);
    background: #e60000;
    box-shadow: 0 12px 30px rgba(255, 0, 0, 0.4);
}

.youtube-fab:active {
    transform: scale(0.9);
}

.youtube-fab svg {
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2));
}

/* Transiciones SVG (V1.8) */
#transition-veil {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10000;
}
#transition-veil svg {
    width: 100vw;
    height: 100vh;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.85, 0, 0.15, 1);
}
#transition-veil.active svg {
    transform: translateY(0);
}
#transition-veil.exit svg {
    transform: translateY(-100%);
}

/* Card Collapsable y Utilidades Visuales */
.collapsible-card {
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: var(--transition);
}
.collapsible-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}
.collapsible-header:hover {
    filter: brightness(1.05);
}
.collapsible-content {
    max-height: 500px;
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 0 20px 20px 20px;
}
.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-bottom: 0px;
    padding-top: 0px;
}
.chevron-icon {
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
}
.chevron-icon.rotated {
    transform: rotate(180deg);
}

.strike-badge {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
    padding: 6px 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(183, 28, 28, 0.1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.strike-badge:hover {
    transform: scale(1.03);
    background: #ffcdd2;
}
.strike-badge svg {
    animation: pingBadge 1.5s infinite alternate ease-in-out;
}

/* Responsive móvil: evitar desbordamientos en tarjetas */
@media (max-width: 480px) {
    .view {
        padding: var(--spacing-8) 0.75rem;
    }
    .btn {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
    .glass-header {
        padding: 0.75rem 1rem;
    }
}
/* Showcase / Marquee */
.landing-showcase-container {
    margin-top: var(--spacing-12);
    overflow: hidden;
    padding: 20px 0;
    position: relative;
    user-select: none;
}
.showcase-track {
    display: flex;
    gap: 15px;
    width: max-content;
    animation: scrollShowcase 40s linear infinite;
}
.showcase-track:hover {
    animation-play-state: paused;
}
@keyframes scrollShowcase {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.showcase-card {
    width: 160px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px;
    flex-shrink: 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.3s ease;
}
.showcase-card:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(255, 255, 255, 0.9);
}

.showcase-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    background: var(--color-surface-container);
}
.showcase-info h4 {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.showcase-info .negocio-name {
    font-size: 0.65rem;
    color: var(--color-on-surface-variant);
    font-weight: 600;
}
.showcase-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--color-primary);
}
.showcase-comision {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Badge Share Estetico (Movido de negocio.js) */
@keyframes pulseShareAnim {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1) rotate(5deg); color: #00E676; }
}
.badge-share-estetico {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    background: #000000;
    color: #FFFFFF;
    padding: 3px 10px;
    border-radius: 30px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.25s ease;
    width: fit-content;
}
.badge-share-estetico svg {
    animation: pulseShareAnim 2s infinite ease-in-out;
    color: #FFFFFF;
    fill: currentColor;
}

@media (max-width: 480px) {
    .showcase-card {
        width: 140px;
    }
    .showcase-img {
        height: 100px;
    }
}

/* -------------------------------------------------------------------
   PREMIUM BUTTONS (V1.9)
   ------------------------------------------------------------------- */
.btn-premium-share {
    background: linear-gradient(135deg, var(--color-primary), #333) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}
.btn-premium-copy {
    background: var(--color-surface-container-low) !important;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-outline) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.btn-premium-chat {
    background: white !important;
    color: #128C7E !important;
    border: 1.5px solid #25D366 !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
}

.btn-premium-share:hover, .btn-premium-copy:hover, .btn-premium-chat:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.1);
}

@keyframes svgBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.animate-svg-bounce svg {
    animation: svgBounce 2s infinite ease-in-out;
}

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

.animate-svg-pulse svg {
    animation: svgPulse 2s infinite ease-in-out;
}

/* -------------------------------------------------------------------
   AVATARES Y PERFILES
   ------------------------------------------------------------------- */
.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-surface-container);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px solid white;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-md {
    width: 80px;
    height: 80px;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

.avatar-editable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-editable:hover {
    filter: brightness(0.8);
    transform: scale(1.02);
}

.avatar-editable::after {
    content: '📷';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.avatar-editable:hover::after {
    opacity: 1;
}

.avatar-initials {
    font-weight: 800;
    color: var(--color-primary);
    text-transform: uppercase;
    font-size: 1.2rem;
}

.avatar-sm .avatar-initials {
    font-size: 0.9rem;
}

/* -------------------------------------------------------------------
   ANIMACIONES DE NAVEGACIÓN (V1.9.1)
   ------------------------------------------------------------------- */
@keyframes highlightFlash {
    0% { background-color: var(--color-surface-lowest); }
    30% { background-color: var(--color-tertiary); filter: brightness(1.2); transform: scale(1.02); }
    100% { background-color: var(--color-surface-lowest); filter: brightness(1); transform: scale(1); }
}

.notif-highlight {
    animation: highlightFlash 2s ease forwards;
    position: relative;
    z-index: 10;
}
