/* 
   css/style.css
   Wrapito PWA Base Styles
   Mobile First Approach
*/

:root {
    /* Paleta de colores solicitada */
    --primary-color: #f76e08;      /* Naranja para botones (CTA) */
    --primary-hover: #e06004;      
    --accent-color: #69851f;       /* Verde para acentos */
    --bg-color: #ffffff;           /* Fondo blanco */
    
    /* Colores neutros */
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e5e5e5;
    --modal-overlay: rgba(0, 0, 0, 0.4);
    
    /* Tipografía */
    --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Mejora en móviles */
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
}

/* ==========================================================================
   Header (Sticky)
   ========================================================================== */
.header {
    background-color: var(--bg-color);
    padding: 12px 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease;
}

.header.sticky {
    position: sticky;
    top: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); /* Sombra sutil */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo */
.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color); /* Acento verde para el logo */
    letter-spacing: -0.5px;
}

/* Nav Links (Ocultos en móviles, enfocados al diseño mobile-first) */
.main-nav {
    display: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    margin: 0 12px;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   Botones y Acciones
   ========================================================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px; /* Bordes redondeados modernos */
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 4px 6px rgba(247, 110, 8, 0.2);
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 2px solid var(--primary-color);
    padding: 8px 18px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-block {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    margin-top: 20px;
}

/* Controles de Cantidad (+ y -) */
.qty-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.btn-qty {
    background-color: #f0f0f0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.btn-qty:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.qty-number {
    font-weight: 600;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

/* ==========================================================================
   Secciones Principales (Hero y Menú)
   ========================================================================== */
.main-content {
    min-height: calc(100vh - 65px);
    padding-bottom: 40px;
}

/* Hero Banner */
.hero-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    padding: 40px 20px;
    text-align: center;
    border-radius: 0 0 24px 24px;
    margin-bottom: 32px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.banner-content h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: #ffffff;
}

.banner-content p {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

.banner-image img {
    width: 100%;
    max-width: 350px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: rotate(2deg);
    transition: transform 0.3s ease;
}

.banner-image img:hover {
    transform: rotate(-2deg) scale(1.03);
}

@media (min-width: 768px) {
    .hero-banner {
        flex-direction: row;
        text-align: left;
        justify-content: space-around;
        padding: 60px 40px;
    }
    
    .banner-content {
        max-width: 50%;
    }
    
    .banner-content h1 {
        font-size: 3.5rem;
    }
}

/* Sección de Menú */
.menu-section {
    padding: 0 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 24px;
    text-align: center;
}

/* Cuadrícula de Menú (CSS Grid) */
.menu-grid {
    display: grid;
    /* Grid responsivo: mínimo 280px por tarjeta, máximo lo que de la pantalla */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Tarjeta de Producto */
.product-card {
    background-color: var(--bg-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* Placeholder de Imagen */
.card-image-placeholder {
    width: 100%;
    height: 180px;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Contenido de la Tarjeta */
.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1; /* Permite que el footer empuje hacia abajo si las descripciones tienen diferentes alturas */
}

.product-title {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 10px;
}

.product-ingredients {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
    flex: 1; /* Empuja el footer hacia abajo */
}

/* Footer de la Tarjeta */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
}

.btn-add-cart {
    padding: 8px 18px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Nuevas Secciones: Anatomía, Frescura y Proceso de Entrega
   ========================================================================== */

/* Anatomía del Wrapito */
.anatomy-section {
    padding: 60px 20px;
    background-color: #fff;
    text-align: center;
}

.anatomy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1000px;
    margin: 40px auto 0;
    gap: 30px;
}

.anatomy-image img {
    width: 100%;
    max-width: 400px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.anatomy-image img:hover {
    transform: scale(1.05) rotate(2deg);
}

.anatomy-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.label-item {
    background-color: var(--bg-color);
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.label-item .icon {
    font-size: 1.2rem;
    margin-right: 5px;
}

/* Ingredientes Frescos */
.fresh-ingredients {
    background-color: var(--accent-color);
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}

.fresh-content {
    max-width: 800px;
    margin: 0 auto;
}

.fresh-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
}

.fresh-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* Proceso de Entrega */
.delivery-process {
    padding: 60px 20px;
    background-color: var(--bg-color);
    text-align: center;
}

.process-steps {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1000px;
    margin: 40px auto 0;
}

.step {
    background-color: #fff;
    padding: 30px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.step-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.modern-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(247, 110, 8, 0.1), rgba(105, 133, 31, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(247, 110, 8, 0.1);
}

.modern-icon svg {
    width: 34px;
    height: 34px;
}

.step h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.step p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (min-width: 768px) {
    .anatomy-container {
        flex-direction: row;
        justify-content: center;
        gap: 50px;
    }
    
    .anatomy-labels {
        flex-direction: column;
        align-items: flex-start;
        max-width: 300px;
    }

    .process-steps {
        flex-direction: row;
    }
    
    .step {
        flex: 1;
    }
}

/* ==========================================================================
   Modal de Login/Registro
   ========================================================================== */
.modal {
    display: none; /* Controlado por JS */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    align-items: flex-end; /* Mobile-first: Modal estilo bottom sheet */
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-color);
    width: 100%;
    padding: 32px 24px 40px; /* Padding extra abajo para móviles */
    border-radius: 24px 24px 0 0; /* Curvas arriba solo */
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Transición suave */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-content h2 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* Input Group (Teléfono) */
.input-group {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-color);
    transition: border-color 0.2s ease;
}

.input-group:focus-within {
    border-color: var(--primary-color);
}

.prefix-phone {
    padding: 14px 16px;
    background-color: #f7f7f7;
    color: var(--text-main);
    font-weight: 600;
    border-right: 1px solid var(--border-color);
    font-size: 1rem;
}

input[type="tel"] {
    flex: 1;
    border: none;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: var(--font-family);
    background: transparent;
    outline: none;
    color: var(--text-main);
    width: 100%;
}

input[type="tel"]::placeholder {
    color: #a0a0a0;
}

/* ==========================================================================
   Carrito y Animaciones
   ========================================================================== */

/* Animación Latido (Pulse) para Botones */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(247, 110, 8, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(247, 110, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(247, 110, 8, 0); }
}

.pulse {
    animation: pulseGlow 2s infinite ease-in-out;
}

/* Widget del Carrito (Sidebar / Pop up flotante) */
.cart-sidebar {
    position: fixed;
    background-color: var(--bg-color);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2); /* Sombra hacia arriba */
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.4s;
    
    /* Mobile First: Pop-up anclado abajo pero que permite navegación */
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 50vh; /* Solo cubre media pantalla máximo */
    border-radius: 24px 24px 0 0;
    transform: translateY(150%); /* Oculto abajo */
    visibility: hidden;
}

.cart-sidebar.show {
    transform: translateY(0);
    visibility: visible;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.3rem;
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.close-cart-btn:hover {
    color: var(--primary-color);
}

.cart-items {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}

.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
}

.cart-item-qty {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cart-item-price {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background-color: #fafafa;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: 600;
}

.cart-total strong {
    color: var(--primary-color);
    font-size: 1.6rem;
}

/* Elemento volador animado */
.flying-item {
    position: fixed;
    z-index: 9999;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0.8;
    pointer-events: none;
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==========================================================================
   Media Queries (Escritorio / Tablets Grandes)
   ========================================================================== */
@media (min-width: 768px) {
    /* Mostrar navegación en pantallas grandes */
    .main-nav {
        display: flex;
        align-items: center;
    }
    
    /* El modal se centra en pantallas grandes en lugar de estar abajo */
    .modal {
        align-items: center;
    }
    
    .modal-content {
        max-width: 420px;
        border-radius: 20px;
        transform: scale(0.9) translateY(0);
        padding: 40px 30px;
    }
    
    .modal.show .modal-content {
        transform: scale(1) translateY(0);
    }
    
    /* Sidebar del Carrito en Escritorio (Anclado a la derecha) */
    .cart-sidebar {
        top: 0;
        right: 0;
        left: auto;
        bottom: auto;
        width: 400px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translateX(100%); /* Oculto a la derecha */
    }
    
    .cart-sidebar.show {
        transform: translateX(0); /* Visible */
    }
}
