/* ===================================
   STYLES.CSS - ABARROTES JIREH
   Tienda de Abarrotes
   Paleta: Dorado, Verde, Crema
   "Estamos para servirle"
   =================================== */

/* RESET Y VARIABLES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales de ABARROTES JIREH */
    --primary-color: #228B22;           /* Verde Bosque */
    --secondary-color: #DAA520;         /* Dorado */
    --accent-color: #D4AF37;            /* Dorado metálico */
    --white-color: #ffffff;             /* Blanco puro */
    --cream-color: #FFF8DC;             /* Crema */
    
    /* Colores de estado */
    --success-color: #27ae60;
    --warning-color: #DAA520;
    --danger-color: #dc3545;
    
    /* Grises y neutros */
    --light-gray: #F5F5DC;              /* Beige claro */
    --dark-gray: #7f8c8d;
    --text-color: #3D2914;              /* Café oscuro */
    --border-color: #E8DCC8;
    
    /* Efectos */
    --shadow: 0 2px 10px rgba(218, 165, 32, 0.15);
    --shadow-gold: 0 4px 15px rgba(218, 165, 32, 0.25);
    --gradient-jireh: linear-gradient(135deg, #228B22 0%, #32CD32 50%, #DAA520 100%);
    --gradient-jireh-alt: linear-gradient(to right, #DAA520 0%, #228B22 100%);
    --gradient-gold: linear-gradient(135deg, #B8860B 0%, #DAA520 50%, #FFD700 100%);
    --gradient-green: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #FFFAF0;
}

/* CONTENEDOR PRINCIPAL */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* HEADER */
header {
    background: white;
    box-shadow: 0 2px 5px rgba(218, 165, 32, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    background: var(--gradient-jireh);
    color: white;
    padding: 8px 0;
    font-size: 0.9rem;
}

.header-top .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-main {
    padding: 1rem 0;
    background: linear-gradient(to bottom, #FFFAF0 0%, #ffffff 100%);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    background: var(--gradient-jireh);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: 1px;
}

.logo-image {
    height: 70px;
    width: auto;
}

/* NAVEGACIÓN */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: var(--secondary-color);
}

/* HEADER ACTIONS */
.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.header-actions a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.header-actions a:hover {
    color: var(--secondary-color);
}

.cart-count {
    background: var(--gradient-gold);
    color: #2C1810;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(218, 165, 32, 0.3);
}

/* BANNER */
.hero-banner {
    background: var(--gradient-jireh);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="rgba(255,255,255,0.05)"/></svg>');
    background-size: 100px 100px;
}

.hero-banner h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.hero-banner p {
    font-size: 0.95rem;
    opacity: 0.95;
    position: relative;
    margin: 0;
}

/* LAYOUT PRINCIPAL */
.main-content {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

/* SIDEBAR */
.sidebar {
    flex: 0 0 250px;
}

/* CATEGORÍAS MÓVIL - SOLO VISIBLE EN MÓVIL */
.categorias-movil {
    display: none !important; /* OCULTO en desktop */
    overflow-x: auto;
    white-space: nowrap;
    padding: 6px 10px;
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categorias-movil::-webkit-scrollbar {
    display: none;
}

.cat-movil-item {
    display: inline-block;
    padding: 5px 12px;
    margin-right: 6px;
    background: white;
    border-radius: 15px;
    color: #333;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #ccc;
}

.cat-movil-item:hover,
.cat-movil-item.active {
    background: var(--primary-color, #228B22);
    color: white;
    border-color: var(--primary-color, #228B22);
}

.sidebar-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border-top: 3px solid var(--secondary-color);
}

.sidebar-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    transition: all 0.3s;
}

.category-list a:hover {
    color: var(--secondary-color);
    padding-left: 5px;
}

.category-count {
    background: var(--cream-color);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid var(--secondary-color);
}

/* CONTENT AREA */
.content {
    flex: 1;
}

/* GRID DE PRODUCTOS */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* TARJETA DE PRODUCTO */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-gold);
    border-color: var(--secondary-color);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: linear-gradient(135deg, #FFF8DC 0%, #F5F5DC 100%);
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #ffffff 0%, #FFFAF0 100%);
}

.product-category {
    color: var(--primary-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    min-height: 2.4em;
}

.product-description {
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex: 1;
}

.product-price-section {
    margin-bottom: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.product-price.has-discount {
    color: var(--primary-color);
}

.product-old-price {
    text-decoration: line-through;
    color: var(--dark-gray);
    font-size: 1rem;
    margin-left: 0.5rem;
}

.product-discount {
    background: var(--gradient-gold);
    color: #2C1810;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(218, 165, 32, 0.3);
}

/* ===================================
   BOTONES RESPONSIVE - ABARROTES JIREH
   =================================== */

/* Contenedor de acciones del producto */
.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: auto;
}

/* Botones principales */
.btn-ver-detalles,
.btn-agregar-carrito,
.btn-action,
.btn-primary,
.btn-secondary {
    /* Tamaño adaptable */
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.8rem, 3vw, 1.2rem);
    
    /* Estilos visuales con colores de ABARROTES JIREH */
    background: var(--gradient-gold);
    color: #2C1810;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* Flexibilidad */
    width: 100%;
    max-width: 200px;
    min-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* Centrado */
    display: inline-block;
    text-align: center;
    text-decoration: none;
    
    /* Sombra dorada */
    box-shadow: 0 3px 10px rgba(218, 165, 32, 0.4);
}

/* Hover effect */
.btn-ver-detalles:hover,
.btn-agregar-carrito:hover,
.btn-action:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(218, 165, 32, 0.5);
    background: linear-gradient(135deg, #FFD700 0%, #DAA520 100%);
}

/* Active state */
.btn-ver-detalles:active,
.btn-agregar-carrito:active,
.btn-action:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(218, 165, 32, 0.4);
}

/* Botón secundario (verde) */
.btn-secondary,
.btn-outline {
    background: var(--gradient-green);
    border: none;
    color: white;
    box-shadow: 0 3px 10px rgba(34, 139, 34, 0.3);
}

.btn-secondary:hover,
.btn-outline:hover {
    background: linear-gradient(135deg, #32CD32 0%, #228B22 100%);
    box-shadow: 0 5px 15px rgba(34, 139, 34, 0.4);
}

/* Tamaños de botones */
.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    max-width: 150px;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
    max-width: 250px;
}

/* Estados especiales */
.btn-ver-detalles:focus,
.btn-agregar-carrito:focus,
.btn-action:focus {
    outline: 3px solid rgba(218, 165, 32, 0.5);
    outline-offset: 2px;
}

.btn-ver-detalles:disabled,
.btn-agregar-carrito:disabled,
.btn-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-ver-detalles:disabled:hover,
.btn-agregar-carrito:disabled:hover,
.btn-action:disabled:hover {
    transform: none;
    box-shadow: 0 3px 10px rgba(218, 165, 32, 0.4);
}

/* Íconos en botones */
.btn-ver-detalles i,
.btn-agregar-carrito i,
.btn-action i {
    margin-right: 0.3rem;
    font-size: 0.9em;
}

/* Botón de administrador */
.btn-admin {
    background: var(--gradient-jireh) !important;
    color: white !important;
    padding: 8px 20px !important;
    border-radius: 50px !important;
    font-weight: bold !important;
    box-shadow: 0 3px 10px rgba(34, 139, 34, 0.3) !important;
    transition: all 0.3s !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
}

.btn-admin:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(34, 139, 34, 0.5) !important;
}

.btn-admin i {
    font-size: 1rem;
}

/* CARRITO */
.cart-summary {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
    border-top: 3px solid var(--secondary-color);
}

.cart-total {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 1rem 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* FORMULARIOS */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: #FFFAF0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(218, 165, 32, 0.2);
}

/* ALERTAS */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background: #FFF8DC;
    color: #3D2914;
    border: 1px solid #DAA520;
    border-left: 4px solid var(--secondary-color);
}

/* FOOTER */
footer {
    background: var(--gradient-green);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: white;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: white !important;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--secondary-color) !important;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.3);
    opacity: 0.9;
}

/* Slogan en footer */
.footer-slogan {
    font-style: italic;
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* ═════════════════════════════════════════════════════════════ */
/*  📱 MENÚ HAMBURGUESA RESPONSIVE                               */
/* ═════════════════════════════════════════════════════════════ */

/* Botón hamburguesa - oculto por defecto en escritorio */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-btn span {
    width: 100%;
    height: 3px;
    background: var(--secondary-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
    background: white;
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
    background: white;
}

/* ===================================
   RESPONSIVE BREAKPOINTS
   =================================== */

/* Media queries para móvil */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa en móvil */
    .hamburger-btn {
        display: flex;
    }
    
    /* Ocultar texto en acciones del header */
    .hide-mobile {
        display: none;
    }
    
    /* Menú principal - oculto por defecto en móvil */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--gradient-jireh);
        padding: 5rem 2rem 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 15px rgba(218, 165, 32, 0.3);
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .main-nav a {
        color: white !important;
        font-size: 1.1rem;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .main-nav a:hover {
        color: var(--secondary-color) !important;
    }
}

/* Tablets grandes y escritorios pequeños (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .btn-ver-detalles,
    .btn-agregar-carrito,
    .btn-action {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        max-width: 180px;
    }
}

/* Tablets (481px - 767px) */
@media (max-width: 767px) {
    .header-content {
        flex-direction: column;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    /* Sidebar compacto en tablets */
    .sidebar {
        flex: 1;
        order: 2; /* Mover debajo de productos */
    }
    
    .content {
        order: 1; /* Productos primero */
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .hero-banner h1 {
        font-size: 2rem;
    }
    
    .btn-ver-detalles,
    .btn-agregar-carrito,
    .btn-action {
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem;
        max-width: 160px;
    }
}

/* Móviles (320px - 480px) */
@media (max-width: 480px) {
    /* MOSTRAR BARRA DE CATEGORÍAS HORIZONTAL EN MÓVIL */
    .categorias-movil {
        display: block !important;
    }
    
    /* OCULTAR SIDEBAR VERTICAL EN MÓVIL */
    .sidebar {
        display: none !important;
    }
    
    /* Layout limpio */
    .main-content {
        display: block;
        margin: 0.3rem 0;
        gap: 0;
    }
    
    .content {
        width: 100%;
    }
    
    /* PRODUCTOS COMPACTOS - 2 columnas ajustadas */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        padding: 0 0.3rem;
    }
    
    /* Tarjetas de producto más pequeñas */
    .product-card {
        padding: 0.4rem;
        border-radius: 6px;
    }
    
    .product-card img {
        height: 90px;
        border-radius: 4px;
    }
    
    .product-card h3 {
        font-size: 0.75rem;
        margin: 0.2rem 0;
        line-height: 1.15;
        max-height: 2.3em;
        overflow: hidden;
    }
    
    .product-card .price {
        font-size: 0.85rem;
        margin: 0.15rem 0;
    }
    
    .product-card .description,
    .product-card p:not(.price) {
        display: none; /* Ocultar descripción en móvil */
    }
    
    /* Botones de acción compactos */
    .product-actions {
        gap: 0.2rem;
        flex-direction: column;
        margin-top: 0.3rem;
    }
    
    .product-actions .btn-ver-detalles,
    .product-actions .btn-agregar-carrito,
    .btn-ver-detalles,
    .btn-agregar-carrito,
    .btn-action {
        font-size: 0.6rem;
        padding: 0.35rem 0.5rem;
        width: 100%;
        max-width: none;
        min-width: auto;
    }
    
    .header-actions {
        gap: 0.6rem;
    }
    
    /* HERO ULTRA COMPACTO */
    .hero-banner {
        padding: 0.5rem 0;
        margin-bottom: 0;
    }
    
    .hero-banner h1 {
        font-size: 0.95rem;
        margin-bottom: 0;
    }
    
    .hero-banner p {
        font-size: 0.7rem;
        margin: 0;
    }
    
    /* Título de sección más pequeño */
    .content h2 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
        padding: 0 0.3rem;
    }
}

/* Móviles muy pequeños (menos de 320px) */
@media (max-width: 319px) {
    .btn-ver-detalles,
    .btn-agregar-carrito,
    .btn-action {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
        max-width: 120px;
    }
}

/* UTILIDADES */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

.hidden {
    display: none;
}

/* Estilos especiales para imágenes de productos */
.product-image {
    background: linear-gradient(135deg, #FFF8DC 0%, #F5F5DC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #DAA520;
    font-size: 3rem;
}

.product-image.loaded {
    background: none;
}

.product-image.error {
    background: var(--gradient-jireh);
    color: white;
}

/* Efecto brillo dorado */
.golden-shine {
    position: relative;
    overflow: hidden;
}

.golden-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 215, 0, 0.3) 50%,
        transparent 60%
    );
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}
