/* ============================================
   Variables CSS - Design System (Sports World Dark Premium)
   ============================================ */
:root {
    --color-background: #363636;
    --color-text-primary: #FFFFFF;
    --color-text-secondary: #A0A0A0;
    --color-accent: #FFFFFF;
    --transition-speed: 0.5s;
    --transition-easing: ease-in-out;
    --border-radius: 12px;
    --border-radius-pill: 50px;
    --font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* ============================================
   Banner Container
   ============================================ */
.banner-container {
    width: 300px;
    height: 600px;
    position: relative;
    background: var(--color-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ============================================
   State Management
   ============================================ */
.state {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) var(--transition-easing),
                visibility var(--transition-speed) var(--transition-easing);
}

.state.active {
    opacity: 1;
    visibility: visible;
}

.state.hidden {
    opacity: 0;
    visibility: hidden;
}

/* ============================================
   Estado 1: El Gancho (Attract Loop)
   ============================================ */
.state-1 {
    background: var(--color-background);
    display: flex;
    flex-direction: column;
}

.state1-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.top-section {
    padding: 16px 16px 12px;
    background: var(--color-background);
}

.branding {
    text-align: center;
    margin-bottom: 12px;
}

.logo-image {
    max-width: 200px;
    width: auto;
    height: auto;
    max-height: 50px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.headline {
    text-align: center;
    color: var(--color-text-primary);
    padding: 0 8px;
}

.headline h1 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.image-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background);
    padding: 0;
    overflow: hidden;
}

.mirror-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.bottom-section {
    padding: 12px 16px 16px;
    background: var(--color-background);
}

.cta-primary {
    background: var(--color-accent);
    color: var(--color-background);
    border: none;
    padding: 14px 28px;
    border-radius: var(--border-radius-pill);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-speed) var(--transition-easing),
                box-shadow var(--transition-speed) var(--transition-easing);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: var(--font-family);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    display: block;
}

.cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

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

/* Animación de pulso */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ============================================
   Estado 2: Simulación de Escaneo
   ============================================ */
.state-2 {
    background: var(--color-background);
    display: flex;
    flex-direction: column;
}

.app-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.app-header h2 {
    font-size: 18px;
    color: var(--color-text-primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.camera-viewport {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 320px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#cameraVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

#capturedImage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
}

.viewport-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid var(--color-accent);
}

.corner-tl {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.corner-tr {
    top: 10px;
    right: 10px;
    border-left: none;
    border-bottom: none;
}

.corner-bl {
    bottom: 10px;
    left: 10px;
    border-right: none;
    border-top: none;
}

.corner-br {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

.viewport-placeholder {
    text-align: center;
    color: var(--color-text-secondary);
    z-index: 1;
}

.placeholder-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.viewport-placeholder p {
    font-size: 14px;
    font-weight: 500;
}

/* Animación de escaneo */
.scanning-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    z-index: 2;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--color-accent),
        transparent
    );
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    animation: scanDown 3s linear;
}

@keyframes scanDown {
    0% {
        top: 0;
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0.2;
    }
}

.scan-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-text-primary);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    background: rgba(28, 28, 28, 0.95);
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: textFade 1s ease-in-out infinite;
}

@keyframes textFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.app-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-camera,
.btn-upload {
    flex: 1;
    background: transparent;
    color: var(--color-text-primary);
    border: 2px solid var(--color-accent);
    padding: 14px 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-speed) var(--transition-easing),
                background var(--transition-speed) var(--transition-easing),
                color var(--transition-speed) var(--transition-easing);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: var(--font-family);
}

.btn-camera:hover,
.btn-upload:hover {
    transform: translateY(-2px);
    background: var(--color-accent);
    color: var(--color-background);
}

.btn-camera:active,
.btn-upload:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 24px;
}

.btn-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Estado 3: El Reveal (Slider Antes/Después)
   ============================================ */
.state-3 {
    background: var(--color-background);
    display: flex;
    flex-direction: column;
}

.results-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.results-header {
    text-align: center;
    margin-bottom: 20px;
}

.results-header h2 {
    font-size: 20px;
    color: var(--color-text-primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Slider Container - Componente estrella */
.slider-container {
    position: relative;
    width: 100%;
    height: 350px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.slider-container:active {
    cursor: grabbing;
}

.slider-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.slider-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Imagen de fondo (Después - Versión Premium) */
.slider-after {
    z-index: 1;
}

/* Imagen de frente (Antes - Versión Normal) */
.slider-before {
    z-index: 2;
    clip-path: inset(0 0 0 50%);
    transition: clip-path 0.1s ease-out;
}

/* Control deslizante */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--color-accent);
    transform: translateX(-50%);
    z-index: 3;
    cursor: grab;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.slider-handle:active {
    cursor: grabbing;
}

.handle-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: var(--color-accent);
    color: var(--color-background);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--color-background);
}

.cta-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cta-final {
    background: var(--color-accent);
    color: var(--color-background);
    text-decoration: none;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: transform var(--transition-speed) var(--transition-easing),
                box-shadow var(--transition-speed) var(--transition-easing);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cta-final:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.cta-final:active {
    transform: translateY(0);
}
