/* ===========================================
   El Precio Justo AR - Mobile-first Styles
   =========================================== */

/* CSS Variables */
:root {
    --color-primary: #4CAF50;
    --color-primary-dark: #388E3C;
    --color-secondary: #FFC107;
    --color-secondary-dark: #FFA000;
    --color-accent: #FF5722;
    --color-bg: #1a1a2e;
    --color-surface: #16213e;
    --color-surface-light: #1f2b47;
    --color-text: #ffffff;
    --color-text-muted: #a0a0a0;
    --color-success: #4CAF50;
    --color-error: #f44336;
    --color-exact: #FFD700;
    --transition-speed: 0.3s;
    --border-radius: 12px;
    --border-radius-lg: 20px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Screen System */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* Container */
.container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* ===========================================
   Pantalla de Inicio
   =========================================== */

#screen-inicio {
    justify-content: center;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo-emoji {
    font-size: 40px;
    animation: pulse 2s ease-in-out infinite;
}

.logo h1 {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.intro-icons {
    font-size: 32px;
    letter-spacing: 8px;
    margin-bottom: 24px;
    opacity: 0.9;
}

.intro-text {
    font-size: 16px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 32px;
}

.record-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 20px;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--color-text-muted);
}

.record-display .trophy {
    font-size: 20px;
}

.record-display strong {
    color: var(--color-secondary);
}

/* ===========================================
   Buttons
   =========================================== */

.btn {
    width: 100%;
    max-width: 280px;
    min-height: 56px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: var(--color-surface-light);
    color: var(--color-text);
    border: 2px solid var(--color-primary);
}

/* ===========================================
   Game Header
   =========================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-surface-light);
}

.ronda {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.ronda span {
    color: var(--color-text);
    font-weight: 700;
}

.puntaje {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-secondary);
}

/* ===========================================
   Pantalla de Juego
   =========================================== */

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.producto-card {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.producto-emoji {
    font-size: 80px;
    line-height: 1;
    margin-bottom: 16px;
}

.producto-nombre {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.producto-pista {
    font-size: 14px;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Input Section */
.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-label {
    font-size: 16px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.precio-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.peso-sign {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
}

.precio-input {
    width: 180px;
    padding: 12px 16px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    background: var(--color-surface);
    border: 2px solid var(--color-surface-light);
    border-radius: var(--border-radius);
    color: var(--color-text);
    transition: border-color var(--transition-speed);
    -moz-appearance: textfield;
}

.precio-input::-webkit-outer-spin-button,
.precio-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.precio-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.precio-input::placeholder {
    color: var(--color-text-muted);
}

/* Slider */
.slider-container {
    width: 100%;
    max-width: 320px;
    margin-bottom: 32px;
}

.precio-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--color-surface-light);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    margin-bottom: 8px;
}

.precio-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.precio-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.precio-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ===========================================
   Pantalla de Resultado
   =========================================== */

.resultado-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.resultado-card {
    padding: 16px;
    margin-bottom: 16px;
}

.resultado-card .producto-emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.resultado-card .producto-nombre {
    font-size: 18px;
}

/* Precios Comparacion */
.precios-comparacion {
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.precio-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.precio-row:first-child {
    border-bottom: 1px solid var(--color-surface-light);
}

.precio-label {
    font-size: 14px;
    color: var(--color-text-muted);
}

.precio-valor {
    font-size: 20px;
    font-weight: 700;
}

.precio-real .precio-valor {
    color: var(--color-primary);
}

/* Feedback */
.resultado-feedback {
    text-align: center;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--border-radius-lg);
    background: var(--color-surface);
    width: 100%;
    animation: slideUp 0.4s ease-out;
}

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

.feedback-mensaje {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
}

.feedback-puntos {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-secondary);
}

/* Feedback states */
.resultado-feedback.exacto {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
}

.resultado-feedback.exacto .feedback-puntos {
    color: #1a1a2e;
}

.resultado-feedback.muy-cerca {
    background: linear-gradient(135deg, var(--color-primary), #2E7D32);
}

.resultado-feedback.cerca {
    background: var(--color-primary-dark);
}

.resultado-feedback.bien {
    background: #558B2F;
}

.resultado-feedback.regular {
    background: #F57C00;
}

.resultado-feedback.lejos {
    background: #E64A19;
}

.resultado-feedback.muy-lejos {
    background: var(--color-error);
}

.diferencia-info {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* ===========================================
   Pantalla Final
   =========================================== */

.final-container {
    text-align: center;
    padding: 20px;
}

.final-header {
    margin-bottom: 24px;
}

.final-emoji {
    font-size: 64px;
    display: block;
    margin-bottom: 12px;
    animation: bounce 0.6s ease-out;
}

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

.final-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.puntaje-final {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.puntaje-label {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.puntaje-numero {
    font-size: 48px;
    font-weight: 800;
    color: var(--color-secondary);
    line-height: 1;
    margin-bottom: 8px;
}

.puntaje-max {
    font-size: 12px;
    color: var(--color-text-muted);
}

.record-final {
    margin-bottom: 20px;
}

.nuevo-record {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
    font-size: 16px;
    font-weight: 800;
    border-radius: var(--border-radius);
    animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 10px #FFD700; }
    to { box-shadow: 0 0 30px #FFD700; }
}

.stats-final {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
}

.stat {
    text-align: center;
}

.stat-valor {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.final-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* ===========================================
   Responsive - Tablet & Desktop
   =========================================== */

@media (min-width: 768px) {
    .logo h1 {
        font-size: 36px;
    }

    .logo-emoji {
        font-size: 48px;
    }

    .producto-emoji {
        font-size: 100px;
    }

    .producto-nombre {
        font-size: 26px;
    }

    .precio-input {
        font-size: 32px;
        width: 200px;
    }

    .final-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

/* ===========================================
   Animations & Utilities
   =========================================== */

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

/* Hide number input arrows on mobile */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
