/* VARIABLES GLOBALES */
:root {
    --aguamarina: #20b2aa;
    --aguamarina-hover: #1c9c95;
    --gris-claro: #f4f4f4;
    --gris-medio: #808080;
    --rojo: #ff0000;
    --azul-ojo: #007bff;
    --naranja-oscuro: #d35400;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23e8e8e8' stroke-width='0.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'%3E%3C/circle%3E%3Ccircle cx='20' cy='21' r='1'%3E%3C/circle%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'%3E%3C/path%3E%3C/svg%3E");
    background-size: 20px 20px;
    background-repeat: repeat;
    padding-top: 75px; 
    padding-bottom: 120px; 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* BARRA SUPERIOR */
.barra-superior {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 75px;
    background-color: #ffffff;
    border-bottom: 2px solid var(--gris-claro);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}

.header-izq {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-tienda {
    width: 180px;
    height: auto;
    display: block;
}

.logout-container {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.btn-logout {
    color: var(--aguamarina);
    font-size: 24px;
}

/* BOTONES */
.btn-aguamarina {
    background-color: var(--aguamarina);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}
.btn-aguamarina:hover {
    background-color: var(--aguamarina-hover);
}

/* ESTILOS FORMULARIOS OPTIMIZADOS */
.formulario-estilizado {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.formulario-estilizado input[type="text"],
.formulario-estilizado input[type="password"],
.formulario-estilizado input[type="email"],
.formulario-estilizado input[type="number"],
.formulario-estilizado input[type="url"],
.formulario-estilizado textarea,
.formulario-estilizado select {
    display: block;
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 14px !important;
    padding: 12px 15px !important;
    font-size: 15px !important;
    color: #333;
    background-color: #fff;
    border: 2px solid var(--aguamarina) !important;
    border-radius: 8px !important;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.formulario-estilizado input:focus,
.formulario-estilizado textarea:focus,
.formulario-estilizado select:focus {
    border-color: var(--aguamarina-hover) !important;
    box-shadow: 0 0 8px rgba(32, 178, 170, 0.3);
    background-color: #f9ffff;
}

.formulario-estilizado textarea {
    min-height: 90px;
    resize: vertical;
}

.formulario-estilizado button[type="submit"] {
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    margin-top: 5px;
}

/* CAMPO PASSWORD WRAPPER */
.campo-password-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}

.campo-password-wrapper .icono-ojo-toggle {
    position: absolute;
    right: 15px;
    top: 15px;
    cursor: pointer;
    color: var(--gris-medio);
    font-size: 18px;
    z-index: 10;
}

/* BOTÓN DE ELIMINAR PEDIDO (ADMIN) */
.eliminar-pedido-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #cc0000;
    text-decoration: none;
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    padding: 2px 6px;
    transition: color 0.2s;
    z-index: 20;
}
.eliminar-pedido-btn:hover {
    color: #ff0000;
    transform: scale(1.1);
}

/* BARRA DE CANASTA FIJA INFERIOR */
.barra-canasta-fija-inferior {
    position: fixed;
    bottom: 50px; 
    left: 0;
    width: 100%;
    height: 55px;
    background-color: var(--aguamarina);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    z-index: 2001; 
    transition: background-color 0.3s ease;
    border: none;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.15);
}
.barra-canasta-fija-inferior:hover {
    background-color: #ff8c00 !important; 
}
.punto-notificacion-barra {
    width: 12px;
    height: 12px;
    background-color: var(--rojo);
    border-radius: 50%;
    border: 2px solid white;
}

/* MARQUESINA */
.marquesina-contenedor {
    width: 100%;
    background-color: #ffffff;
    overflow: hidden;
    border-bottom: 1px solid var(--gris-claro);
    padding: 5px 0;
}
.marquesina-texto {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: marcha-atras 15s linear infinite;
    color: var(--rojo);
    font-weight: bold;
    font-size: 16px;
}
@keyframes marcha-atras {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

.contenedor-principal {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.bienvenida-banner h2 {
    color: #333333;
    font-size: 20px;
    margin-bottom: 25px;
}

/* GRID DE PRODUCTOS */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 15px;
    justify-content: center;
}

.producto-card {
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
    overflow: hidden;
    color: #000000;
}

.producto-card:hover {
    background-color: var(--aguamarina);
    border-color: var(--gris-medio);
}
.producto-card:hover h4, 
.producto-card:hover .cat-tag,
.producto-card:hover .precio {
    color: #000000 !important;
}

.producto-card img {
    max-width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 10px;
}

.precio {
    font-size: 26px;
    font-weight: bold;
    color: var(--rojo) !important;
    text-align: center;
    margin: 10px 0;
    width: 100%;
    display: block;
}

.producto-card.agotado-card {
    filter: grayscale(1);
    opacity: 0.7;
}
.badge-agotado {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--rojo);
    font-size: 26px;
    font-weight: bold;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 4px;
    border: 2px solid var(--rojo);
    white-space: nowrap;
}

.badge-decorativo {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    background: #ff8c00;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 3px;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.cat-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--gris-claro);
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 12px;
    color: #555;
    font-weight: bold;
}

/* PANEL ADMIN */
.panel-admin {
    background: #fff;
    border: 1px solid var(--gris-medio);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.card-admin {
    background: #fafafa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #eaeaea;
}
.card-admin h4 {
    margin-bottom: 10px;
    color: #444;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}
.card-admin form input, .card-admin form textarea, .card-admin form select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.lista-pedidos-admin, .lista-categorias-admin, .lista-usuarios-admin, .lista-productos-admin {
    max-height: 220px;
    overflow-y: auto;
}

/* BARRA INFERIOR */
.barra-inferior {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: #ffffff;
    border-top: 2px solid var(--gris-claro);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
}
.footer-categorias { flex: 1; }
.categoria-item-click {
    margin-left: 10px;
    color: var(--aguamarina);
    cursor: pointer;
    text-decoration: underline;
}
.footer-ayuda-whatsapp { flex: 1; text-align: center; }
.footer-ayuda-whatsapp a {
    color: var(--aguamarina);
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
}
.footer-firma { flex: 1; text-align: right; color: var(--gris-medio); font-weight: 500; }

/* MODALES Y CAPAS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
}

/* RESOLUCIÓN COMPUTADORES */
@media (min-width: 769px) {
    .modal-producto-ancho {
        max-width: 80% !important;
        width: 80% !important;
        height: 80vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .modal-producto-ancho .producto-detalle-flex {
        height: 100%;
        align-items: center;
    }
    .modal-producto-ancho .visor-imagenes-container {
        height: 70vh !important;
    }
}

.close-btn { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: var(--gris-medio); }

.visor-imagenes-container {
    position: relative; 
    width: 100%;
    height: 280px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.capa-protectora-click {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0);
    z-index: 10;
    cursor: grab;
}
.capa-protectora-click:active { cursor: grabbing; }

.imagen-visor-zoom {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

.flecha-visor {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
    transition: background 0.2s;
}
.flecha-visor:hover { background: rgba(0,0,0,0.8); }
.flecha-izq { left: 10px; }
.flecha-der { right: 10px; }

.controles-zoom {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 15;
}
.btn-zoom {
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.btn-zoom:hover { background: rgba(0,0,0,0.8); }

.producto-detalle-flex { display: flex; gap: 20px; align-items: center; margin-top: 15px; }
.prod-det-izq { flex: 1; position: relative; }
.prod-det-der { flex: 1.2; }

.icono-ojo-toggle.activo-azul { color: var(--azul-ojo) !important; }

.letrero-contraentrega { border: 2px solid var(--gris-medio); color: var(--rojo); background-color: #fff8f8; padding: 12px; font-weight: bold; text-align: center; margin-top: 15px; border-radius: 4px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--gris-claro); padding: 8px 0; }

/* SECCIÓN SMARTPHONES / MÓVILES */
@media (max-width: 768px) {
    .contenedor-principal {
        padding: 5px !important;
    }
    
    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(95%, 1fr)) !important;
        gap: 10px !important;
    }
    
    .producto-card {
        width: 100% !important;
        border-radius: 0px !important;
    }

    .modal-producto-ancho {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        overflow: hidden !important;
        background-color: #000; 
    }

    .producto-detalle-flex {
        flex-direction: column !important;
        gap: 0 !important;
        height: 100% !important;
        width: 100% !important;
        position: relative !important;
    }

    .prod-det-izq {
        width: 100% !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 1 !important;
    }

    .modal-producto-ancho .visor-imagenes-container {
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border: none !important;
        border-radius: 0 !important;
        background: #000 !important;
    }

    .modal-producto-ancho .imagen-visor-zoom {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; 
    }

    .prod-det-der {
        width: calc(100% - 20px) !important;
        position: absolute !important;
        bottom: 15px !important;
        left: 10px !important;
        background: rgba(255, 255, 255, 0.92) !important; 
        backdrop-filter: blur(8px) !important; 
        padding: 15px !important;
        border-radius: 12px !important;
        z-index: 5 !important; 
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        max-height: 50vh !important;
        overflow-y: auto !important;
        padding-right: 90px !important; 
    }

    /* === ESTILOS PARA EL ACORDEÓN DE LA DESCRIPCIÓN EN MÓVIL === */
    .contenedor-cabecera-acordeon-movil {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        cursor: pointer !important;
        user-select: none !important;
        padding: 4px 0 !important;
        border-bottom: 1px dashed rgba(0, 0, 0, 0.15) !important;
        margin-bottom: 6px !important;
    }

    #pop-titulo {
        font-size: 15px !important; 
        font-weight: 700 !important;
        color: #111 !important;
        margin-bottom: 0px !important; 
        display: block !important;
        flex: 1 !important;
    }

    .flecha-acordeon-movil {
        font-size: 14px !important;
        color: var(--aguamarina) !important;
        transition: transform 0.3s ease !important;
        margin-left: 8px !important;
    }

    #pop-descripcion {
        font-size: 12px !important;
        color: #444 !important;
        line-height: 1.4 !important;
        display: block !important;
        max-height: 0px !important; 
        overflow: hidden !important;
        transition: max-height 0.3s ease-out, margin-top 0.3s ease !important;
        margin-bottom: 5px !important;
        margin-top: 0px !important;
    }

    .acordeon-activo .flecha-acordeon-movil {
        transform: rotate(180deg) !important; 
    }

    .acordeon-activo + #pop-descripcion {
        max-height: 200px !important; 
        margin-top: 8px !important;
        overflow-y: auto !important;
    }
    /* ========================================================== */
    
    #pop-precio {
        font-size: 18px !important;
        text-align: left !important;
        margin: 5px 0 0 0 !important;
        display: block !important;
        color: var(--rojo) !important;
    }

    #pop-action-container {
        position: absolute !important;
        bottom: 15px !important;
        right: 15px !important;
        z-index: 10 !important;
        width: auto !important;
        display: block !important;
        float: none !important;
        margin-top: 0 !important;
    }

    .btn-pedir-formato, #pop-action-container .btn-aguamarina {
        font-size: 13px !important;
        padding: 10px 14px !important;
        border-radius: 20px !important; 
        box-shadow: 0 4px 10px rgba(0,0,0,0.3) !important;
        white-space: nowrap !important;
        font-weight: bold !important;
    }

    .modal-producto-ancho .close-btn {
        top: 15px !important;
        right: 15px !important;
        background-color: var(--naranja-oscuro) !important;
        color: white !important;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        font-size: 24px !important;
        z-index: 100 !important; 
        box-shadow: 0 3px 10px rgba(0,0,0,0.5);
    }

    .barra-superior { padding: 0 10px; }
    .barra-inferior { flex-direction: column; height: auto; padding: 10px; gap: 10px; padding-bottom: 115px; } 
    .footer-firma, .footer-ayuda-whatsapp { text-align: center; }
    .admin-grid { grid-template-columns: 1fr; }
}