/* ===== Variables CSS ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

/* Menu Desktop */
.nav-menu-desktop {
    display: flex;
    gap: 2rem;
}

.nav-menu-desktop a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu-desktop a:hover {
    color: var(--primary-color);
}

/* Botón de carrito con icono */
.cart-btn-icon {
    position: relative;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-dark);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-btn-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.cart-btn-icon:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.cart-btn-icon:active {
    transform: scale(0.95);
}

/* Badge del carrito */
.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    transition: var(--transition);
}

/* Ocultar badge cuando está vacío o en 0 */
.cart-badge:empty,
.cart-badge[data-count="0"] {
    display: none;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Botón Hamburguesa (oculto por defecto) ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: var(--transition);
}

.menu-toggle:hover .hamburger-line {
    background: var(--primary-dark);
}

/* ===== Menú Móvil Overlay (COMPLETAMENTE OCULTO por defecto) ===== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.mobile-menu-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== Menú Móvil Sidebar ===== */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: linear-gradient(180deg, #1f2937 0%, #111827 50%, #1f2937 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10000;
}

.mobile-menu-overlay.active .mobile-menu {
    transform: translateX(0);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Header del menú móvil */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.mobile-menu-logo h2 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
}

.menu-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.close-icon {
    color: white;
    font-size: 28px;
    line-height: 1;
}

/* === Perfil de Usuario en Menú Móvil === */
.mobile-user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin: 1rem 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navegación móvil */
.mobile-nav-menu {
    flex: 1;
    padding: 1rem;
}

.mobile-nav-section {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.mobile-nav-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.mobile-nav-link {
    display: block;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

/* === Sección Dashboard === */
.mobile-dashboard-section {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.dashboard-button {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.dashboard-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.dashboard-button-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-button-icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 2;
}

/* Footer del menú móvil */
.mobile-menu-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.4);
    text-align: center;
}

.mobile-menu-footer p {
    color: white;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.mobile-menu-footer-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 400;
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-btn {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 1rem 2.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ===== Section Title ===== */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

/* ===== About Section ===== */
.about {
    padding: 5rem 0;
    background: var(--bg-light);
}

.about-content p {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 3rem;
}

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

.feature {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.feature p {
    color: var(--text-light);
}

/* ===== Products Section ===== */
.products {
    padding: 5rem 0;
}

.loading {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 2rem;
    background: #fee2e2;
    border-radius: 8px;
    color: #991b1b;
}

.retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--bg-light);
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.product-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.add-to-cart-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.add-to-cart-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.add-to-cart-btn:active {
    transform: scale(0.95);
}

/* ===== Contact Section ===== */
.contact {
    padding: 5rem 0;
    background: var(--bg-light);
}

.contact-content {
    max-width: 800px;
    margin: 0 auto;
}

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

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.contact-icon {
    font-size: 2.5rem;
}

.contact-item h3 {
    margin-bottom: 0.3rem;
    color: var(--text-dark);
}

.contact-item p {
    color: var(--text-light);
}

/* ===== Footer (ahora en components/footer.css) ===== */

/* ===== Modal Carrito ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qty-btn {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
}

.qty-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.remove-item-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    transition: var(--transition);
}

.remove-item-btn:hover {
    background: #dc2626;
}

.cart-empty {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-light);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.checkout-btn {
    width: 100%;
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.checkout-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.checkout-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* ===== WhatsApp Button ===== */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: var(--transition);
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

/* ===== Responsive ===== */

/* Tablet y Mobile */
@media (max-width: 768px) {
    /* OCULTAR menú desktop */
    .nav-menu-desktop {
        display: none !important;
    }

    /* MOSTRAR botón hamburguesa */
    .menu-toggle {
        display: flex !important;
    }

    /* Ajustes del navbar */
    .navbar {
        padding: 0.75rem 0;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .cart-btn-icon {
        padding: 0.4rem;
    }

    .cart-btn-icon svg {
        width: 22px;
        height: 22px;
    }

    .cart-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    /* Ajustes de secciones */
    .hero {
        padding: 4rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
}

/* Desktop - Asegurar que hamburguesa NUNCA se vea */
@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }

    .nav-menu-desktop {
        display: flex !important;
    }
}

/* Mobile pequeño */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 3rem 0;
    }

    .cart-item {
        flex-direction: column;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .cart-btn-icon {
        padding: 0.35rem;
    }

    .cart-btn-icon svg {
        width: 20px;
        height: 20px;
    }

    .cart-badge {
        min-width: 14px;
        height: 14px;
        font-size: 0.6rem;
        top: 1px;
        right: 1px;
    }
}
