/* --- 1. Importación de Fuente y Variables de Diseño --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Poppins', sans-serif;
    --color-primary: #3A86FF;
    --color-accent: #FFBE0B;
    --color-surface: #FFFFFF;
    --color-background: #F7F9FC;
    --color-text: #1F2937;
    --color-text-subtle: #6B7280;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
}

/* --- 2. Estilos Generales y Reset --- */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-background);
    color: var(--color-text);
    margin: 0;
    line-height: 1.6;
}

/* --- 3. Encabezado y Contenido Principal --- */
header {
    background-color: var(--color-surface);
    text-align: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

main {
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

/* --- 4. Slider y Tarjetas de Producto --- */
.slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding: 0.25rem 0.25rem 1.5rem 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto; /* Dejamos que el navegador decida si mostrar el scrollbar */
}

.product-card {
    flex: 0 0 180px;
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
    scroll-snap-align: start;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-medium);
}

.product-card.selected {
    transform: translateY(-6px);
    box-shadow: var(--shadow-medium);
    border-color: var(--color-primary);
}

.product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.product-card h3 {
    font-size: 1rem;
    font-weight: 500;
    margin: 0.5rem 0 0.25rem 0;
}

.product-card .price {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-subtle);
}

/* --- 5. Sección de la Calculadora --- */
.calculator-container {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-soft);
}

#calculator {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

#calculator img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.calc-details h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-subtle);
    margin-bottom: 0.5rem;
    display: block;
}

.input-group input {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 500;
    width: 180px;
    padding: 0.75rem 1rem;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.2);
}

/* --- 6. Contenedor de Resultados --- */
#result-wrapper {
    margin-top: 2rem;
    text-align: center;
}

#result-container {
    background-color: var(--color-background);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #E5E7EB;
}

#result-container p {
    margin: 0.5rem 0;
}

#result-container .price-applied {
    font-size: 0.9rem;
    color: var(--color-text-subtle);
}

#result-container .total-price {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 0.5rem;
}

.hidden {
    display: none !important;
}

/* --- 7. Adaptación para pantallas más pequeñas (Mobile First) --- */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    .calculator-container {
        padding: 1.5rem;
    }
    #calculator {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .input-group input {
        width: 100%;
    }
    .calc-details h2 {
        font-size: 1.5rem;
    }
    #result-container .total-price {
        font-size: 2rem;
    }
}
