/* =========================================
   1. CORE VARIABLES & THEME
   ========================================= */
:root {
    --primary: #E3001B; 
    --accent: #FFD700; /* Gold */
    --dark: #121212;    
    --bg: #F2F2F7;        
    
    /* Glassmorphism Styles */
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-blur: blur(20px);
    
    --text-main: #000000;
    --text-white: #ffffff;
    --radius-xl: 24px; 
    --radius-m: 18px;
    
    /* Shadows */
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.1);
    --shadow-deep: 0 20px 40px rgba(0,0,0,0.3);
    
    /* Safe Areas (Mobile) */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

body.dark-mode {
    --text-main: #ffffff;
    --glass-bg: rgba(30, 30, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* =========================================
   2. GLOBAL RESET & BODY
   ========================================= */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
    user-select: none; 
}

body {
    margin: 0; 
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, sans-serif;
    /* Ajuste de ruta: css está en /css y la imagen en /assets */
    background: url('../assets/fondo.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    transition: color 0.3s;
    overscroll-behavior-y: none;
}

/* =========================================
   3. LAYOUT STRUCTURE (SPA Feel)
   ========================================= */
#app-viewport {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(65px + var(--safe-bottom));
}

.view {
    display: none;
    height: 100%;
    overflow-y: auto;
    /* Espacio para el Header fijo arriba y el TabBar abajo */
    padding: calc(85px + var(--safe-top)) 0 20px 0;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; 
}

.view.active { 
    display: block; 
    opacity: 1; 
}

.hidden-section { 
    display: none !important; 
}

/* =========================================
   4. HEADER (Global)
   ========================================= */
header {
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0;
    height: calc(65px + var(--safe-top));
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(25px); 
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    z-index: 999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    transition: transform 0.3s;
}

body.dark-mode header { 
    background: rgba(20, 20, 20, 0.7); 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
}

/* Logo Setup */
.header-title img { 
    height: 100px; 
    width: auto; 
    display: block; 
    transform: translateY(40px) translateX(-70px); 
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
} 

/* Cart/Action Button in Header */
.header-action { 
    position: absolute; 
    right: 20px; 
    bottom: 12px; 
    color: var(--primary); 
    font-size: 13px; 
    font-weight: 800; 
    text-transform: uppercase;
    background: rgba(227,0,27,0.1); 
    padding: 8px 16px; 
    border-radius: 30px;
    cursor: pointer; 
    transition: transform 0.2s; 
    letter-spacing: 0.5px;
}
.header-action:active { 
    transform: scale(0.95); 
}

/* =========================================
   5. NAVIGATION (Tab Bar)
   ========================================= */
.tab-bar { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    background: rgba(255,255,255,0.7); 
    backdrop-filter: blur(25px); 
    -webkit-backdrop-filter: blur(25px); 
    border-top: 1px solid rgba(255,255,255,0.3); 
    display: flex; 
    justify-content: space-around; 
    padding: 12px 0 calc(8px + var(--safe-bottom)) 0; 
    z-index: 1000; 
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05); 
}

body.dark-mode .tab-bar { 
    background: rgba(20, 20, 20, 0.7); 
    border-top: 1px solid rgba(255,255,255,0.05); 
}

.tab { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    color: #999; 
    font-size: 10px; 
    font-weight: 600; 
    cursor: pointer; 
    width: 25%; 
    transition: all 0.2s; 
}

.tab img { 
    width: 26px; 
    height: 26px; 
    margin-bottom: 4px; 
    object-fit: contain; 
    opacity: 0.5; 
    transition: all 0.2s; 
}

.tab svg { 
    width: 26px; 
    height: 26px; 
    margin-bottom: 4px; 
    fill: currentColor; 
    transition: all 0.2s; 
}

.tab.active { 
    color: var(--primary); 
    transform: translateY(-2px); 
}

.tab.active img { 
    opacity: 1; 
    /* Filtro para colorear imágenes PNG a rojo/primary */
    filter: invert(16%) sepia(99%) saturate(7404%) hue-rotate(358deg) brightness(95%) contrast(114%); 
}

.tab.active svg { 
    fill: var(--primary); 
}

/* =========================================
   6. GLOBAL MODALS
   ========================================= */
.custom-modal-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex; 
    align-items: center; 
    justify-content: center;
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.custom-modal-overlay.open { 
    opacity: 1; 
    pointer-events: all; 
}

.custom-modal-box {
    background: rgba(255,255,255,0.9);
    width: 85%; 
    max-width: 320px;
    padding: 30px 25px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.8) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.5);
}

.custom-modal-overlay.open .custom-modal-box { 
    transform: scale(1) translateY(0); 
}

.modal-icon { 
    font-size: 40px; 
    margin-bottom: 15px; 
    display: block; 
}

.modal-title { 
    margin: 0 0 10px 0; 
    font-size: 20px; 
    font-weight: 800; 
    color: #000; 
}

.modal-text { 
    margin: 0 0 25px 0; 
    color: #666; 
    font-size: 15px; 
    line-height: 1.4; 
}

.modal-btn { 
    background: var(--primary); 
    color: white; 
    border: none; 
    padding: 12px 30px; 
    border-radius: 30px; 
    font-weight: 700; 
    font-size: 14px; 
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(227, 0, 27, 0.3);
    width: 100%;
    transition: transform 0.2s;
}

.modal-btn:active {
    transform: scale(0.98);
}

/* =========================================
   7. UTILITY ANIMATIONS
   ========================================= */
/* Animación de rotación para la IA y cargas */
.loading-spin {
    display: inline-block;
    animation: spin 1.5s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* --- Estilos recuperados para Co-Creation --- */
.cocreation-container { 
    padding: 20px; 
    max-width: 500px; 
    margin: 0 auto; 
    transform: translateY(-20px);  
}

.cocreation-card { 
    background: var(--glass-bg); 
    backdrop-filter: var(--glass-blur); 
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); 
    border-radius: var(--radius-xl); 
    padding: 40px 25px; 
    box-shadow: var(--shadow-soft); 
    text-align: center; 
    margin-top: 20px; 
    color: var(--text-main); 
}

.input-idea { 
    width: 100%; 
    padding: 15px; 
    border-radius: 14px; 
    border: 1px solid rgba(0,0,0,0.1); 
    background: rgba(255,255,255,0.6); 
    margin: 25px 0; 
    min-height: 120px; 
    font-family: inherit; 
    font-size: 16px; 
    resize: none; 
    outline: none; 
}
/* Estilos para cabeceras de módulos secundarios */
.view-header-back {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 0 10px;
}

.back-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.order-card {
    background: white;
    border-radius: 18px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.05);
}

.order-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

/* Estilos para la vista de Actividad */
.loyalty-visual.white-mode {
    background: #ffffff !important;
    color: #333 !important;
    border: 1px solid #e0e0e0;
}

.activity-view {
    display: none; /* Oculto por defecto */
    width: 100%;
    height: 100%;
    padding: 15px;
    box-sizing: border-box;
    flex-direction: column;
    justify-content: space-between;
}

.progress-container {
    margin: 15px 0;
    text-align: left;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
    font-weight: 700;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF8C00, #E3001B);
    width: 0%; /* Se calculará con JS */
    transition: width 1s ease-out;
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-val { font-weight: 900; font-size: 16px; color: #000; }
.stat-lbl { font-size: 10px; color: #666; text-transform: uppercase; margin-top: 2px; }

.btn-close-activity {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #eee;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-weight: bold;
    color: #666;
}
/* ================= ESTILOS PREMIUM VISTA BIENVENIDA ================= */

/* Contenedor Principal: Flex vertical para distribuir el espacio */
.welcome-premium-container {
    height: 100vh; /* Ocupa toda la altura de la pantalla */
    height: -webkit-fill-available; /* Fix para Safari iOS */
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    padding: 40px 24px;
    box-sizing: border-box;
    text-align: center;
}

/* Header y Logo */
.wp-header {
    margin-bottom: 20px;
}
.wp-logo {
    width: 140px; /* Logo grande */
    height: auto;
    display: block;
    margin: 0 auto; /* Centrado horizontal */
}

/* Textos Principales */
.wp-title {
    font-size: 28px;
    font-weight: 800;
    color: #E3001B; /* Rojo Idilia */
    margin: 0 0 10px 0;
    line-height: 1.2;
}
.wp-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 40px 0;
}

/* --- TRACKER DE RECOMPENSAS HORIZONTAL --- */
.wp-rewards-tracker {
    flex: 1; /* Ocupa el espacio central disponible */
    display: flex;
    align-items: center; /* Centra verticalmente */
    position: relative;
    margin-bottom: 30px;
}

/* Línea gris de fondo */
.tracker-line-bg {
    position: absolute;
    top: 30px; /* Ajustar según el tamaño del icono */
    left: 15%;
    right: 15%;
    height: 4px;
    background-color: #f0f0f0;
    z-index: 0;
}

/* Contenedor de los pasos */
.tracker-steps {
    display: flex;
    justify-content: space-between;
    width: 100%;
    position: relative;
    z-index: 1; /* Por encima de la línea */
}

/* Cada paso individual */
.t-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 5px;
}

/* Icono circular */
.t-icon {
    width: 60px;
    height: 60px;
    background-color: white;
    border: 3px solid #E3001B; /* Borde rojo Idilia */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(227, 0, 27, 0.1);
}

/* Textos de los pasos */
.t-title {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    margin: 0 0 5px 0;
}
.t-desc {
    font-size: 12px;
    color: #888;
    margin: 0;
    line-height: 1.3;
    max-width: 90px;
}

/* --- BOTONES DE ACCIÓN --- */
.wp-actions {
    margin-top: auto; /* Empuja al fondo */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Botón Principal (Registro) */
.btn-wp-primary {
    width: 100%;
    padding: 16px;
    background-color: #E3001B; /* Rojo Idilia */
    color: white;
    border: none;
    border-radius: 30px; /* Bordes muy redondos estilo app moderna */
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(227, 0, 27, 0.3);
    transition: transform 0.1s;
}
.btn-wp-primary:active { transform: scale(0.98); }

/* Botón Secundario (Login) */
.btn-wp-secondary {
    width: 100%;
    padding: 14px;
    background: none;
    color: #555;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s;
}
.btn-wp-secondary:hover, .btn-wp-secondary:active {
    border-color: #E3001B; /* Rojo al hacer clic/hover */
}
/* Corrección para que la vista de bienvenida no bloquee el login */
#view-welcome {
    display: none !important; /* Oculto por defecto */
}
#view-welcome.active {
    display: flex !important; /* Solo visible si tiene la clase 'active' */
}