/* style.css - Essence Dupe V3 (Responsive & Polished) */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=Jost:wght@300;400;500;600&display=swap');

:root {
    --bg: #ffffff;
    --text: #121212;
    --gold: #D4AF37;
    --gold-dark: #aa8c2c;
    --gray-light: #f9f9f9;
    --gray-border: #e0e0e0;
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Jost', sans-serif;
    --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.6; }

/* HEADER */
header {
    background: rgba(255,255,255,0.98); backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 999;
    padding: 1rem 5%; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05); box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.logo { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: -1px; }

nav { display: flex; align-items: center; }
nav a { text-decoration: none; color: var(--text); margin-left: 1.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; transition: 0.3s; position: relative; font-weight: 500;}
nav a:hover { color: var(--gold); }
.cart-icon { position: relative; font-size: 1.1rem; }
.cart-count { 
    position: absolute; top: -8px; right: -10px; background: var(--text); color: #fff; 
    font-size: 0.6rem; padding: 2px 5px; border-radius: 50%; font-weight: bold;
}

/* HERO SECTION (Faltaba esto) */
.hero {
    height: 70vh;
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('https://res.cloudinary.com/dr3setrsk/image/upload/v1768021186/db3df2aa-6445-4366-8dd9-63365db591b8_kmqpob.jpg');
    background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center; text-align: center; color: white;
}
.hero h2 { font-family: var(--font-heading); font-size: 3.5rem; line-height: 1.1; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; letter-spacing: 2px; text-transform: uppercase; opacity: 0.9; }

/* LAYOUT & GRID */
.container { max-width: 1200px; margin: 0 auto; padding: 4rem 20px; }
.section-title { font-family: var(--font-heading); font-size: 2.5rem; margin-bottom: 3rem; text-align: center; }

.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 40px; 
}

/* PRODUCT CARD */
.product-card { background: white; transition: 0.4s var(--ease); padding-bottom: 10px; }
.product-card:hover { transform: translateY(-5px); }
.product-image-box { 
    height: 320px; background: #f4f4f4; margin-bottom: 20px; 
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-image-box img { max-height: 85%; mix-blend-mode: multiply; transition: 0.5s; }
.product-card:hover img { transform: scale(1.05); }
.product-info { text-align: center; }
.product-name { font-size: 1.1rem; margin-bottom: 5px; font-weight: 500; }
.product-price { color: #666; font-family: var(--font-heading); font-size: 1.2rem; margin-bottom: 15px; }

/* BOTONES */
.btn-primary {
    display: inline-block; width: 100%; padding: 1rem; background: var(--text); color: white;
    border: none; text-transform: uppercase; letter-spacing: 2px; font-size: 0.75rem; cursor: pointer;
    transition: 0.3s; text-align: center; text-decoration: none; font-weight: 600;
}
.btn-primary:hover { background: var(--gold); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid #ccc; width: auto; padding: 8px 20px; }
.btn-secondary:hover { border-color: var(--text); }

/* AUTH (Login/Registro) */
.auth-container { display: flex; min-height: 100vh; }
.auth-image { 
    flex: 1; display: none; /* Oculto en móvil por defecto */
    background-size: cover; background-position: center;
}
.auth-form-box { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px; max-width: 600px; margin: 0 auto; width: 100%; }

/* FORMULARIOS FLOTANTES */
.form-group { position: relative; margin-bottom: 2rem; }
.form-input {
    width: 100%; padding: 0.8rem 0; border: none; border-bottom: 1px solid #ddd;
    background: transparent; font-family: var(--font-body); font-size: 1rem; color: var(--text); outline: none; border-radius: 0;
}
.form-input:focus { border-bottom-color: var(--text); }
.form-label {
    position: absolute; top: 0.8rem; left: 0; color: #999; font-size: 1rem; pointer-events: none; transition: 0.3s;
}
.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
    top: -0.8rem; font-size: 0.75rem; color: var(--gold);
}

/* PERFIL Y TABLAS */
.profile-grid { display: grid; grid-template-columns: 250px 1fr; gap: 4rem; }
.sidebar-menu { border-right: 1px solid #eee; height: 100%; }
.sidebar-menu a { display: block; padding: 10px 0; color: #777; text-decoration: none; margin-bottom: 5px; transition: 0.3s; }
.sidebar-menu a:hover, .sidebar-menu a.active { color: var(--text); font-weight: 500; transform: translateX(5px); }

/* TABLA RESPONSIVA */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { text-align: left; background: #1a1a1a; color: white; padding: 15px; font-weight: 400; font-size: 0.9rem; }
td { padding: 15px; border-bottom: 1px solid #eee; font-size: 0.9rem; }

/* --- RESPONSIVE MOBILE (La clave) --- */
@media (min-width: 768px) {
    .auth-image { display: block; } /* Mostrar imagen login en PC */
}

@media (max-width: 768px) {
    /* Header Móvil */
    header { flex-direction: column; padding: 1rem; }
    nav { margin-top: 15px; width: 100%; justify-content: center; flex-wrap: wrap; gap: 15px; }
    nav a { margin: 0 10px; font-size: 0.75rem; }
    
    /* Hero Móvil */
    .hero { height: 50vh; }
    .hero h2 { font-size: 2.5rem; }

    /* Grid Móvil */
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
    .product-image-box { height: 200px; }
    .container { padding: 2rem 15px; }
    
    /* Perfil Móvil */
    .profile-grid { grid-template-columns: 1fr; gap: 2rem; }
    .sidebar-menu { border-right: none; border-bottom: 1px solid #eee; padding-bottom: 20px; display: flex; overflow-x: auto; gap: 20px; }
    .sidebar-menu a { white-space: nowrap; transform: none !important; }

    /* Tablas */
    th, td { padding: 10px; font-size: 0.8rem; }
}

/* --- FOOTER --- */
.site-footer {
    background-color: #111;
    color: white;
    margin-top: 60px;
    border-top: 1px solid #222;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-col h4 {
    margin-bottom: 1.2rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.footer-col a {
    color: #999;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    transition: 0.3s;
}

.footer-col a:hover {
    color: var(--gold);
    transform: translateX(5px);
}

.copyright {
    border-top: 1px solid #222;
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
}

/* --- SELECTOR DE CANTIDAD MODERNO (Estilo Cápsula) --- */

/* Contenedor principal */
.qty-selector {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50px; /* Bordes redondos estilo pastilla */
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03); /* Sombra sutil */
    overflow: hidden;
    height: 36px; /* Altura fija para uniformidad */
    min-width: 100px;
}

/* Los botones de + y - */
.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; /* Cuadrados perfectos */
    height: 100%;
    background: #fff;
    color: #333;
    font-size: 0.8rem;
    text-decoration: none !important; /* IMPORTANTE: Quita el subrayado */
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Efecto Hover en botones */
.qty-btn:hover {
    background: #f5f5f5;
    color: var(--gold); /* Tu color dorado */
}

/* El número en el centro */
.qty-value {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #000;
    user-select: none; /* Evita que se seleccione el texto al hacer clic rápido */
    border-left: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- WHATSAPP FLOTANTE --- */
.whatsapp-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25D366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    background-color: #20bd5a;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Animación de pulso sutil */
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-btn {
    animation: pulse-green 2s infinite;
}

/* --- BOTONES DE COMPROBANTE --- */

/* Botón "Subir Comprobante" (Perfil) */
.btn-upload-proof {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #1a1a1a;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-upload-proof:hover {
    background-color: var(--gold);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

/* Botón "Ver Comprobante" (Admin) */
.btn-admin-view {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #fff;
    color: #333;
    padding: 4px 10px;
    border-radius: 20px; /* Estilo píldora */
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
    margin-top: 5px;
}

.btn-admin-view i {
    color: var(--gold-dark); /* Icono dorado */
}

.btn-admin-view:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
    background-color: #fffbf0; /* Fondo crema muy suave */
}

/* --- DESCRIPCIÓN DEL PRODUCTO EN TARJETA --- */
.product-desc {
    font-size: 0.9rem;       /* Letra un poco más pequeña */
    color: #777;             /* Gris suave para no competir con el título */
    margin-bottom: 10px;
    font-family: var(--font-body);
    font-style: italic;      /* Cursiva para evocar elegancia */
    line-height: 1.4;
    
    /* TRUCO PRO: Limitar a 2 líneas y poner "..." si sobra texto */
    display: -webkit-box;
    -webkit-line-clamp: 2;   /* Número de líneas visibles */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px;        /* Altura mínima para alinear botones */
}

/* --- INDICADOR FLOTANTE DE USUARIO --- */
.user-badge {
    position: fixed;
    bottom: 30px;
    left: 30px; /* A la izquierda para no tapar WhatsApp */
    z-index: 999;
    animation: slideUpBadge 0.5s ease-out;
}

.user-badge a {
    display: flex;
    align-items: center;
    background: white;
    padding: 8px 20px 8px 8px; /* Padding asimétrico */
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-decoration: none;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-badge:hover a {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.user-icon {
    width: 35px;
    height: 35px;
    background-color: var(--text); /* Negro */
    color: var(--gold); /* Icono dorado */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.welcome-text {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.name-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* Animación de entrada */
@keyframes slideUpBadge {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ajuste para móvil (hacerlo un poco más pequeño) */
@media (max-width: 768px) {
    .user-badge {
        bottom: 20px;
        left: 20px;
    }
    .user-badge a {
        padding: 6px 15px 6px 6px;
    }
    .user-icon {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    .welcome-text { font-size: 0.6rem; }
    .name-text { font-size: 0.8rem; }
}

/* --- FIX FINAL V3: MÓVIL ROBUSTO --- */
@media (max-width: 768px) {

    /* 1. REGLA DE ORO: Todo cabe en la caja */
    * {
        box-sizing: border-box; /* El padding no aumenta el ancho */
    }

    /* 2. CONTENEDORES PRINCIPALES */
    .container {
        padding: 10px 15px !important;
        width: 100% !important;
        overflow-x: hidden;
    }
    
    .checkout-box {
        display: flex;
        flex-direction: column;
        width: 100% !important;
        margin: 0 !important;
        gap: 20px;
    }

    .checkout-details, .checkout-summary {
        width: 100% !important;
        min-width: 0 !important; /* Permite encogerse */
        padding: 0 !important;
    }

    /* 3. ROMPER LA TABLA (Transformación a Bloques) */
    .checkout-details table, 
    .checkout-details tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Ocultar encabezados negros */
    .checkout-details thead { display: none !important; }

    /* 4. LA TARJETA DEL PRODUCTO (Fila TR) */
    .checkout-details tbody tr {
        display: flex !important; /* Usamos Flexbox */
        flex-wrap: wrap;          /* Permitir que baje de línea */
        background: #fff;
        border: 1px solid #eee;
        border-radius: 12px;
        margin-bottom: 20px;
        padding: 15px;
        position: relative;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
        width: 100% !important;
    }

    /* 5. SECCIÓN PRODUCTO (Imagen y Texto) - Arriba */
    .checkout-details td:nth-child(1) {
        /* Forzar visualización correcta sobrescribiendo PHP */
        display: flex !important; 
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important; /* Ocupa todo el ancho */
        border-bottom: 1px dashed #eee !important;
        padding: 0 0 15px 0 !important;
        margin-bottom: 15px !important;
    }

    /* Arreglar tamaño de imagen */
    .checkout-details td:nth-child(1) img {
        width: 60px !important;
        height: 60px !important;
        object-fit: contain;
        background: #f9f9f9;
        border-radius: 8px;
        margin-right: 15px;
        flex-shrink: 0; /* Que no se aplaste */
    }

    /* 6. CANTIDAD - Abajo Izquierda */
    .checkout-details td:nth-child(2) {
        display: block !important;
        width: 50% !important;
        text-align: left !important;
        padding: 0 !important;
        border: none !important;
    }

    /* 7. PRECIO - Abajo Derecha */
    .checkout-details td:nth-child(3) {
        display: flex !important;
        width: 50% !important;
        justify-content: flex-end; /* A la derecha */
        align-items: center;
        padding: 0 !important;
        border: none !important;
        font-weight: bold;
        color: var(--gold-dark);
        font-size: 1.1rem;
    }

    .checkout-details td:nth-child(3)::before {
        content: "Total: ";
        font-size: 0.8rem;
        color: #999;
        margin-right: 5px;
        font-weight: normal;
    }

    /* 8. BOTÓN ELIMINAR - Flotante */
    .checkout-details td:nth-child(4) {
        position: absolute !important;
        top: 10px;
        right: 10px;
        width: auto !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }
    .checkout-details td:nth-child(4) a {
        color: #ff6b6b;
        font-size: 1.2rem;
        padding: 5px;
    }

    /* 9. ARREGLAR OPCIONES DE ENVÍO (Para que no se corten) */
    .shipping-option {
        display: flex !important;
        flex-direction: column !important; /* Texto abajo */
        align-items: flex-start !important;
        width: 100% !important;
        white-space: normal !important; /* Permitir salto de línea */
        height: auto !important;
    }
    
    .shipping-option > div {
        width: 100% !important;
    }
    
    .shipping-option > div:last-child {
        text-align: right;
        margin-top: 10px;
        border-top: 1px solid #f9f9f9;
        padding-top: 5px;
        width: 100%;
    }
}