/* --- Variables & Reset --- */
:root {
    --primary-color: #00796b; /* Verde azulado principal */
    --primary-dark: #004d40;
    --primary-light: #4db6ac;
    /* Definir RGB para usar en rgba() */
    --primary-rgb: 0, 121, 107;
    --secondary-color: #1b5e20; /* Verde oscuro títulos */
    --accent-color: #f9a825; /* Amarillo/Mostaza */

    --bg-start: #e3f2fd;
    --bg-end: #f1f8e9;
    --surface-transparent: rgba(255, 255, 255, 0.65);
    --surface-opaque: #ffffff;
    --header-bg: var(--primary-dark);
    --footer-bg: #263238;

    --text-dark: #111;
    --text-medium: #444;
    --text-light: #ffffff;
    --text-footer: #cfd8dc;
    --text-success: #2e7d32;
    --text-error: #c62828;

    --font-family: 'Raleway', sans-serif;
    --border-radius: 20px;
    --border-radius-small: 10px;
    --shadow-light: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-medium: 0 10px 30px rgba(0, 0, 0, 0.1);
    --glass-blur: 10px;
    --transition-speed: 0.3s;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-family); }
html { font-size: 16px; }
body {
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit;}

/* --- Vue Cloak & Transitions --- */
[v-cloak] > * { display:none; }
[v-cloak]::before { content: "Cargando..."; display: block; text-align: center; padding: 40px; font-size: 1.2em; color: var(--text-medium); }

.fade-enter-active, .fade-leave-active { transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; transform: translateY(15px); }
.section-wrapper { width: 100%; }

/* --- Layout Principal --- */
#app { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }
header {
    background-color: var(--header-bg); color: var(--text-light); padding: 1rem 2rem;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); flex-shrink: 0;
    position: sticky; top: 0; z-index: 100;
}
header .logo { height: 40px; }
header span { font-weight: 700; }

.main-content {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 2rem; width: 100%;
}

.container {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    max-width: 550px; width: 100%; min-height: 65vh; padding: 2rem;
    border-radius: var(--border-radius); background: var(--surface-transparent);
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    text-align: center; box-shadow: var(--shadow-medium); position: relative;
}

footer {
    background-color: var(--footer-bg); color: var(--text-footer); text-align: center;
    padding: 1rem; width: 100%; flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 5; margin-top: auto;
}
.patrocinador { margin-top: 0.5rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.patrocinador img { height: 24px; }

/* --- Estilos Comunes Dentro del Container --- */
.close-btn {
    position: absolute; top: 1rem; right: 1rem; font-size: 1.8rem; color: #aaa; cursor: pointer; line-height: 1;
    background: rgba(0,0,0,0.05); width: 30px; height: 30px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    z-index: 5; /* Por encima del overlay de carga */
}
.close-btn:hover { color: #555; background: rgba(0,0,0,0.1); }
.hero-image { width: 100%; max-width: 250px; border-radius: var(--border-radius); margin-bottom: 1.5rem; }
.title { font-size: 2rem; font-weight: 700; color: var(--secondary-color); margin-bottom: 0.8rem; }
.description { font-size: 1.05rem; margin-bottom: 1.5rem; color: var(--text-medium); max-width: 400px;}
.message { font-size: 1rem; color: var(--text-medium); }
.small-print { font-size: 0.8rem; color: #888; margin-top: 1rem;}
.result { margin-top: 1rem; margin-bottom: 1rem; font-size: 1.1rem; } /* Añadido margin bottom */
.success { color: var(--text-success); font-weight: bold; }
.error { color: var(--text-error); font-weight: bold; }
.user-info {
    background: rgba(255, 255, 255, 0.9); padding: 1.2rem; border-radius: var(--border-radius-small);
    margin-top: 1rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-light);
    text-align: left; width: 100%; max-width: 350px;
}
.user-info p { margin-bottom: 0.5rem; font-size: 0.95rem; color: var(--text-medium);}
.user-info p strong { color: var(--text-dark); }
.points-highlight { color: var(--primary-color); font-weight: 700; font-size: 1.1em;}
.form-message { margin-top: 1rem; margin-bottom: 1rem; }
.button {
    background-color: var(--primary-color); color: var(--text-light); padding: 0.8rem 2rem;
    border-radius: 50px; font-weight: 700; font-size: 1rem; text-transform: uppercase;
    letter-spacing: 0.5px; transition: all 0.2s ease; display: inline-flex;
    align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1rem;
    box-shadow: 0 3px 8px rgba(var(--primary-rgb), 0.3);
}
.button:hover:not(:disabled) {
    background-color: var(--primary-dark);
    box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.4); transform: translateY(-2px);
}
.button:disabled { opacity: 0.6; cursor: not-allowed; background-color: #ccc !important; box-shadow: none; transform: none;}
.button-secondary {
    background-color: var(--surface-opaque); color: var(--primary-color);
    border: 2px solid var(--primary-color); box-shadow: none;
}
.button-secondary:hover:not(:disabled) {
    background-color: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary-dark); color: var(--primary-dark); transform: translateY(-2px);
}

/* --- Overlay de Carga --- */
.loading-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.9); z-index: 200;
    display: flex; justify-content: center; align-items: center; flex-direction: column;
    border-radius: inherit;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1); width: 40px; height: 40px; border-radius: 50%;
    border-left-color: var(--primary-color); animation: spin 1s linear infinite; margin-bottom: 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-overlay p { font-size: 1.1em; color: var(--text-medium); margin-bottom: 0; font-weight: 500; }

/* --- Estilos Específicos de Secciones Vue --- */
.app-section { width: 100%; display: flex; flex-direction: column; align-items: center; }
.app-section.active { display: flex; } /* Mantenido por si acaso */

/* Scan Section */
.qr-reader-styled {
    width: 100%; max-width: 280px; height: 280px; border-radius: var(--border-radius);
    overflow: hidden; margin: 1rem auto 1.5rem auto; position: relative;
    background-color: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}
#qr-reader { width: 100%; height: 100%; }
#qr-reader video { display: block; width: 100%; height: 100%; object-fit: cover; }
.qr-placeholder {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: var(--text-medium); opacity: 0.8; transition: opacity 0.3s ease; pointer-events: none;
}
.qr-placeholder img { width: 50px; filter: none; margin-bottom: 0.5rem; opacity: 0.6;}
.qr-placeholder span { font-size: 0.9rem; }
#qr-reader:has(video) .qr-placeholder { opacity: 0; }

/* Gifts Section */
.gifts-section-layout { width: 100%; }
.gifts-section-layout .title { margin-bottom: 0.5rem; color: var(--secondary-color); }
.points-summary {
    font-size: 0.95rem; color: var(--text-medium); margin-bottom: 1.5rem; background: #eee;
    padding: 0.3rem 0.8rem; border-radius: 50px; display: inline-block; font-weight: 500;
}
.gifts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.2rem; width: 100%; margin-bottom: 2rem;
}
.gift-card {
    background-color: var(--surface-opaque); border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-light); overflow: hidden; cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease; position: relative;
    border: 2px solid transparent;
}
.gift-card:hover:not(.disabled) { transform: translateY(-4px); box-shadow: var(--shadow-medium); }
.gift-image { width: 100%; height: 110px; object-fit: cover; background-color: #f0f0f0; }
.gift-card-body { padding: 0.8rem; text-align: left;}
.gift-name { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.2rem; color: var(--text-dark); }
.gift-points-cost { font-size: 0.9rem; color: var(--primary-color); font-weight: 700; margin-bottom: 0; }
.selected-indicator {
    position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%;
    background-color: var(--text-success); color: white; display: flex; justify-content: center;
    align-items: center; font-size: 0.9rem; font-weight: bold; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.gift-card.selected { border-color: var(--primary-light); }
.gift-card.disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none; }
.out-of-stock-label {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-10deg);
    background-color: rgba(0,0,0,0.7); color: white; padding: 0.2rem 0.6rem;
    border-radius: 4px; font-size: 0.7rem; font-weight: bold; z-index: 2;
}

/* Confirmation / Error Icons */
.confirmation-icon, .error-icon { font-size: 4rem; margin-bottom: 1rem;}
.confirmation-icon { color: var(--text-success); }
.error-icon { color: var(--text-error); }
.error-text { font-weight: 500; color: var(--text-error); }

/* Responsive */
@media (max-width: 600px) {
  .title { font-size: 1.8rem; }
  .container { padding: 1.5rem; min-height: 60vh; }
  .main-content { padding: 1rem; }
  header { padding: 0.8rem 1rem; }
  header .logo { height: 30px; }
  footer { padding: 0.8rem; }
  .gifts-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
  .button { padding: 0.7rem 1.5rem; font-size: 0.9rem;}
}