/* =========================================
   VARIABLES & RESET (Estilo Konbini)
========================================= */
:root {
    --konbini-green: #009944;
    --konbini-blue: #00a0e9;
    --konbini-white: #ffffff;
    --konbini-bg: #f4f6f8;
    --text-dark: #333333;
    --text-light: #777777;
    --border-color: #e0e0e0;
    --price-red: #e60012;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--konbini-bg);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================================
   HEADER & NAVEGACIÓN
========================================= */
.konbini-header {
    background-color: var(--konbini-white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* La clásica línea de 2 colores de los Konbinis */
.konbini-stripe {
    height: 8px;
    background: linear-gradient(90deg, var(--konbini-green) 50%, var(--konbini-blue) 50%);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 90px; /* Aumentado para mayor visibilidad */
    max-width: 250px;
    object-fit: contain; /* Asegura que la imagen no se deforme ni se aplaste */
    border-radius: 8px;
}

.title-group h1 {
    font-size: 1.5rem;
    color: var(--konbini-blue);
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: bold;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    margin-right: 1.5rem;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--konbini-green);
}

/* Controles de tienda (Moneda, Idioma, Carrito) */
.store-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--konbini-bg);
    cursor: pointer;
    font-weight: 500;
}

#btn-carrito {
    background-color: var(--konbini-blue);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

#btn-carrito:hover {
    background-color: #0088cc;
}

.badge {
    background-color: var(--price-red);
    color: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 0.8rem;
}

/* =========================================
   MAIN & FILTROS
========================================= */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.filtros-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--konbini-white);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

#buscador-productos {
    flex: 1;
    min-width: 200px;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

#filtro-categoria {
    padding: 0.8rem;
    font-size: 1rem;
}

/* =========================================
   REJILLA DE PRODUCTOS
========================================= */
.grid-productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* Así se verá el producto inyectado por JS */
.producto-card {
    background: var(--konbini-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: var(--konbini-green);
}

.producto-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #fff;
    padding: 1rem;
}

.producto-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.producto-titulo {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.producto-precio {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--price-red);
    margin-top: auto;
    margin-bottom: 1rem;
}

.btn-add {
    background-color: var(--konbini-green);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: filter 0.2s;
}

.btn-add:hover {
    filter: brightness(1.1);
}

/* =========================================
   CARRITO LATERAL (Modal Off-canvas)
========================================= */
#carrito-lateral {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    max-width: 100%;
    height: 100vh;
    background: var(--konbini-white);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
}

#carrito-lateral.carrito-visible {
    transform: translateX(0);
}

.carrito-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--konbini-blue);
    color: white;
}

.btn-cerrar {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.carrito-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.carrito-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--konbini-bg);
}

.total-container {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.btn-checkout {
    width: 100%;
    background-color: var(--konbini-green);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
}

/* =========================================
   FOOTER
========================================= */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    background: var(--konbini-white);
    border-top: 1px solid var(--border-color);
}

.firma-jinjo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
}

/* =========================================
   RESPONSIVE DESIGN (Móviles)
========================================= */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .main-nav {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }
    
    .nav-links {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    .nav-links a {
        margin: 0 0.8rem;
    }

    .store-controls {
        justify-content: center;
        width: 100%;
    }

    .filtros-container {
        flex-direction: column;
    }
}

/* =========================================
   PÁGINA SOBRE NOSOTROS
========================================= */
.main-nosotros {
    max-width: 1000px;
}

.seccion-titulo {
    text-align: center;
    color: var(--konbini-blue);
    margin-bottom: 2rem;
    font-size: 2rem;
}

.nosotros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: var(--konbini-white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.nosotros-texto {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 2rem;
}

.info-section h3 {
    color: var(--konbini-green);
    margin-bottom: 0.5rem;
}

.map-container {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.form-section {
    background: var(--konbini-bg);
    padding: 2rem;
    border-radius: 8px;
}

.form-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.btn-enviar {
    background: var(--konbini-blue);
    color: white;
    border: none;
    width: 100%;
    padding: 1rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-enviar:hover {
    background: #0088cc;
}

@media (max-width: 768px) {
    .nosotros-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   MODO NOCHE (DARK MODE)
========================================= */
body.dark-mode {
    --konbini-white: #1e1e1e;   /* Fondo de tarjetas y cabecera */
    --konbini-bg: #121212;      /* Fondo general de la página */
    --text-dark: #f0f0f0;       /* Texto principal (ahora claro) */
    --text-light: #aaaaaa;      /* Texto secundario */
    --border-color: #333333;    /* Bordes más oscuros */
}

/* Estilo para el botón del tema */
#btn-tema {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
    color: var(--text-dark);
}

#btn-tema:hover {
    background: var(--border-color);
    transform: scale(1.1);
}

/* Pequeño ajuste para que las imágenes destaquen bien de noche */
body.dark-mode .producto-img {
    background: #ffffff; /* Mantiene el fondo de la foto blanco para que el producto resalte */
    border-bottom: 1px solid var(--border-color);
}

/* =========================================
   CORRECCIÓN PARA INPUTS Y SELECTS (MODO NOCHE)
========================================= */
input, select, textarea {
    background-color: var(--konbini-bg);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

/* Para que el texto "Buscar snacks..." (placeholder) también cambie de color */
input::placeholder, textarea::placeholder {
    color: var(--text-light);
    opacity: 1; /* Necesario en Firefox */
}

/* Pequeño ajuste para destacar mejor los desplegables y el buscador */
.filtros-container input, .filtros-container select {
    background-color: var(--konbini-white);
}

/* =========================================
   SISTEMA DE AUTENTICACIÓN (LOGIN)
========================================= */
/* Esta clase es la que hace la magia de esconder elementos */
.oculto {
    display: none !important;
}

.btn-auth {
    background-color: #4285F4; /* Azul de Google */
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-auth:hover {
    background-color: #3367D6;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

#foto-perfil {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.btn-logout {
    background: transparent;
    color: var(--price-red);
    border: 1px solid var(--price-red);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-logout:hover {
    background: var(--price-red);
    color: white;
}

.btn-admin {
    background-color: var(--konbini-green);
    color: white;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
}