@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;
html, body { 
    scroll-behavior: smooth; 
    overflow-x: hidden; /* Evita el movimiento lateral en todo el sitio */
    position: relative;
    width: 100%;
}

/* Forzar que los drawers no tengan scroll lateral */
#cart-drawer, #nav-drawer, #auth-drawer {
    overflow-x: hidden !important;
}

#cart-items, #checkout-form, #auth-form {
    overflow-x: hidden !important;
}

body {
...
    background-color: #ffffff;
    color: #000000;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}
/* Forzar comportamiento de cinta única en el checkout móvil */
@media screen and (max-width: 767px) {
    #cart-step-1, #cart-step-2 {
        display: block !important; /* Mata el flex */
        height: auto !important;   /* Mata el h-full */
        overflow: visible !important; /* Deja que el scroll lo maneje el aside padre */
    }
    
    #cart-step-1.hidden, #cart-step-2.hidden {
        display: none !important;
    }

    #cart-items, #checkout-form {
        height: auto !important;
        overflow: visible !important;
    }

    /* Asegurar que el resumen siga al formulario sin espacios forzados */
    #cart-step-2 .mt-auto {
        margin-top: 0 !important;
    }
}

/* Evitar zoom automático en iOS sin sacrificar estética minimalista */
@media screen and (max-width: 767px) {
    .field-group {
        overflow: hidden !important; /* Corta cualquier parte del input que sobresalga por el width: 142% */
    }
    input[type="text"],
...
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Mantiene al navegador feliz para no hacer zoom */
        width: 142.8% !important; /* Compensa la escala (1 / 0.7) */
        transform: scale(0.7); /* Reduce visualmente a ~11px */
        transform-origin: left center;
        margin-bottom: -10px; /* Ajusta el espacio que deja la escala */
    }
}

/* Formularios y Inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.input-error { border-bottom-color: #ef4444 !important; }
.error-message { color: #ef4444; font-size: 8px; text-transform: uppercase; letter-spacing: 0.1em; }

#email-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #f4f4f5;
    z-index: 110;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}
.suggestion-item {
    padding: 8px 12px;
    font-size: 10px;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.2s;
}
.suggestion-item:hover { background: #fafafa; }

/* Botones y Componentes Interactivos */
.size-btn {
    background: transparent !important;
    border: none !important;
    color: #71717a !important;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 4px 0;
    transition: color 0.2s ease;
    position: relative;
    font-weight: 500;
}
.size-btn:hover, .size-btn.active { color: #000000 !important; }
.size-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #000000;
}

button.add-btn-minimal {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #000000 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.15em !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    padding: 6px 12px !important;
    min-width: 80px !important;
    height: 32px !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}
button.add-btn-minimal:hover { 
    background-color: #000000 !important; 
    color: #ffffff !important; 
}

.btn-minimal {
    background-color: transparent;
    color: #000000;
    border: 1px solid #000000;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 10px;
    font-weight: 700;
    padding: 12px 24px;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-minimal:hover {
    background-color: #000000;
    color: #ffffff;
}

/* Grids de Productos */
.product-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 3rem; /* Reducido de 5rem para mayor fluidez */
}
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem; } }

.aspect-landscape { aspect-ratio: 3 / 2; }

/* Utilidades */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.selector-box { display: none; }
.group:hover .selector-box { display: block; }
.selector-box > div { border: 1px solid #e4e4e7 !important; } /* Borde más visible (Zinc-200) */
.selector-box .add-btn-minimal { width: auto !important; } /* Evita botones gigantes en desktop */

@keyframes pricePulse {
    0% { transform: scale(1); color: #000000; }
    50% { transform: scale(1.1); color: #71717a; }
    100% { transform: scale(1); color: #000000; }
}
.price-change { animation: pricePulse 0.4s ease-out; }

/* Inspiración y Descripciones Editoriales */
.z-pattern-block { display: flex; flex-direction: column; gap: 4rem; align-items: center; }
@media (min-width: 1024px) { 
    .z-pattern-block { flex-direction: row; gap: 6rem; }
    .z-pattern-block.inverted { flex-direction: row-reverse; }
}

.text-content { max-width: 400px; }
.step-num { font-size: 9px; text-transform: uppercase; letter-spacing: 0.6em; font-weight: 600; color: #a1a1aa; margin-bottom: 2rem; display: block; }
.block-title { font-size: 24px; text-transform: uppercase; letter-spacing: 0.25em; font-weight: 200; margin-bottom: 2.5rem; color: #000; line-height: 1.5; }
.block-description { font-size: 13px; line-height: 2; color: #71717a; font-weight: 300; letter-spacing: 0.03em; margin-bottom: 2rem; }
.shop-link { font-size: 9px; text-transform: uppercase; letter-spacing: 0.4em; font-weight: 700; color: #000; border-bottom: 1px solid #e4e4e7; padding-bottom: 4px; transition: all 0.3s ease; }
.shop-link:hover { border-color: #000; color: #71717a; }

.image-grid-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3.5rem; width: 100%; max-width: 1300px; }
.image-grid-hero .img-main { grid-column: span 2; grid-row: span 2; }
.image-grid-hero .img-sub { grid-column: span 1; }

.image-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3.5rem; width: 100%; max-width: 1200px; align-items: start; }
.image-grid-1 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; width: 100%; max-width: 1200px; align-items: start; }

.aspect-square { aspect-ratio: 1 / 1; width: 100%; position: relative; }
.aspect-auto { aspect-ratio: auto; width: 100%; }

.img-container { overflow: hidden; background-color: #ffffff; }
.img-container.aspect-square img { width: 100%; height: 100%; object-fit: cover; }
.img-container img { width: 100%; height: auto; display: block; transition: transform 0.8s cubic-bezier(0.2, 0, 0.2, 1); }
.img-container:hover img { transform: scale(1.03); }

/* Pestañas de Cuenta */
.tab-btn {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 10px;
    font-weight: 500;
    color: #a1a1aa;
    transition: color 0.2s ease, transform 0.2s ease;
    padding-bottom: 0.5rem;
    position: relative;
}
.tab-btn:hover { color: #000000; }
.tab-btn.active { color: #000000; font-weight: 700; }
.tab-btn.active::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: #000000;
}
.tab-content { display: none; animation: fadeIn 0.3s ease-in-out; }
.tab-content.active { display: block; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Optimización Responsive: Selectores debajo de la foto en Móvil */
@media (max-width: 767px) {
    /* Forzar que cualquier contenedor que guarde la imagen y el selector se comporte como columna */
    .product-card > div:first-child,
    .product-card .relative,
    .product-card .img-container {
        aspect-ratio: auto !important;
        height: auto !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        background-color: transparent !important; /* Elimina la caja gris (bg-zinc-50) */
    }

    /* La imagen debe ser visible y ocupar su espacio */
    .product-card img {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        height: auto !important;
        display: block !important;
        object-fit: contain !important;
    }

    /* El selector siempre visible y debajo */
    .selector-box {
        display: block !important;
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        padding: 15px 0 5px 0 !important; /* Ajustado para unir con la info */
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    /* Separador por espacio en blanco */
    .product-card {
        padding-bottom: 2rem !important; /* Reducido de 4rem */
    }

    /* Estilizar el recuadro interno del selector para móviles */
    .selector-box > div {
        border: none !important;
        padding: 10px 0 !important;
        background-color: transparent !important;
        box-shadow: none !important; /* Eliminamos la sombra sutil */
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    /* Suavizar botones de tamaño */
    .size-btn {
        font-size: 11px !important; /* Aumentado para mejor legibilidad */
        letter-spacing: 0.15em !important;
        padding: 8px 4px !important; /* Mayor área táctil */
        opacity: 0.6;
    }
    .size-btn.active {
        opacity: 1;
        font-weight: 700 !important;
    }
    .size-btn.active::after {
        height: 1px !important;
        background-color: #000 !important;
        bottom: -2px !important;
    }

    /* Aligerar el botón AGREGAR en móvil */
    .selector-box .add-btn-minimal {
        border: none !important; /* Eliminamos el recuadro negro */
        background: transparent !important;
        color: #000 !important;
        font-weight: 700 !important;
        letter-spacing: 0.3em !important;
        padding: 0 !important;
        min-width: auto !important;
        box-shadow: none !important;
        text-decoration: underline;
        text-underline-offset: 4px;
        text-decoration-thickness: 1px;
    }
}

/* Email Suggestions Styles */
#email-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #f4f4f5;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 8px 12px;
    text-transform: lowercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-item:hover, .suggestion-item.active {
    background: #fafafa;
    color: black;
}
