/* ===== BASE CSS - VERSIÓN FINAL MEJORADA ===== */

:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --secondary-color: #ff8f00;
    --text-dark: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 70px;
}

/* Logo */
.nav-left {
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.8rem;
}

.logo span {
    font-size: 1.2rem;
}

/* Barra de búsqueda */
.nav-center {
    flex: 1;
    max-width: 500px;
    margin: 0 1rem;
}

.search-form {
    display: flex;
    position: relative;
    width: 100%;
}

.search-form input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: var(--bg-light);
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    background: white;
}

.search-form button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s;
}

.search-form button:hover {
    color: var(--primary-color);
}

/* Sección derecha - SOLO ESCRITORIO */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Botones de autenticación */
.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-login, .btn-register {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-login {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-login:hover {
    background: var(--border-color);
}

.btn-register {
    background: var(--primary-color);
    color: var(--white);
}

.btn-register:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Carrito */
.cart-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--bg-light);
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    position: relative;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.cart-button:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cart-badge {
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 30px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* User Menu - CORREGIDO */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0.4rem 1rem 0.4rem 0.5rem;
    border-radius: 50px;
    transition: all 0.3s;
}

.user-menu-btn:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 500;
    color: var(--text-dark);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
    
    /* Cambiar de display:none a opacity/visibility para mejor transición */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* Hover en todo el contenedor, no solo en el botón */
.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* También mantener visible cuando el mouse está sobre el dropdown */
.user-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: background 0.3s;
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item i {
    width: 20px;
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.text-danger {
    color: #dc3545 !important;
}

.text-danger i {
    color: #dc3545 !important;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: background 0.3s;
}

.mobile-menu-btn:hover {
    background: var(--bg-light);
}

.mobile-menu-btn i {
    font-size: 1.8rem;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-dark);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: background 0.3s;
}

.mobile-menu-btn:hover {
    background: var(--bg-light);
}

.mobile-menu-btn i {
    font-size: 1.8rem;
}

/* Mobile menu - OCULTO POR DEFECTO */
.mobile-menu {
    display: none;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}

/* SOLO visible en móvil con clase active */
@media (max-width: 768px) {
    .mobile-menu.active {
        display: block;
        animation: slideDown 0.3s ease;
    }
}

/* Garantizar que en pantallas grandes NUNCA se muestre */
@media (min-width: 769px) {
    .mobile-menu {
        display: none !important;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Resto de estilos del menú móvil... */
.mobile-search {
    margin-bottom: 1.5rem;
}

.mobile-search form {
    display: flex;
    gap: 0.5rem;
}

.mobile-search input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
}

.mobile-search button {
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

.user-email {
    font-weight: 500;
    color: var(--text-dark);
    word-break: break-all;
}

.mobile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.3s;
    background: var(--bg-light);
}

.mobile-link:hover {
    background: var(--border-color);
}

.mobile-link i {
    width: 24px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.mobile-link span {
    flex: 1;
    font-weight: 500;
}

.mobile-link.text-danger i {
    color: #dc3545;
}

.mobile-link.text-danger span {
    color: #dc3545;
}

/* Estilo para el badge del carrito en móvil */
.mobile-link .cart-badge {
    margin-left: auto;
    background: var(--secondary-color);
    color: white;
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    min-width: 20px;
    text-align: center;
}

/* Messages */
.messages-container {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 2rem;
    width: 100%;
}

.alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.close-alert {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    color: inherit;
    opacity: 0.5;
}

.close-alert:hover {
    opacity: 1;
}

/* Main Content */
.main-content {
    flex: 1;
    width: 100%;
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
    width: 100%;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h4 {
    color: var(--text-dark);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.footer-section p {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.footer-section a {
    display: block;
    color: var(--text-light);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    width: 36px;
    height: 36px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark) !important;
    transition: all 0.3s;
}

.social-link:hover {
    background: var(--primary-color);
    color: var(--white) !important;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-lighter);
    font-size: 0.9rem;
}

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

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0.75rem 1.5rem;
    }
    
    .auth-buttons span,
    .cart-text {
        display: none;
    }
    
    .btn-login, .btn-register,
    .cart-button {
        padding: 0.6rem;
        font-size: 1.1rem;
    }
    
    .btn-login i, .btn-register i,
    .cart-button i {
        font-size: 1.2rem;
    }
    
    .logo span {
        font-size: 1.1rem;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
    
    .nav-center {
        max-width: 350px;
    }
    
    .user-name {
        max-width: 80px;
    }
    
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Móvil (max 768px) */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.6rem 1rem;
    }
    
    /* OCULTAR TODO LO QUE VA EN EL MENÚ HAMBURGUESA */
    .nav-center,
    .nav-right {
        display: none;
    }
    
    /* Mostrar solo el botón hamburguesa y el logo */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Reorganizar elementos: Logo a la izquierda, hamburguesa a la derecha */
    .nav-left {
        order: 1;
    }
    
    .mobile-menu-btn {
        order: 2;
    }
    
    /* Logo simplificado */
    .logo span {
        display: none;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    /* Footer responsive */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem 1.5rem;
    }
}

/* Móvil muy pequeño (max 380px) */
@media (max-width: 380px) {
    .nav-container {
        padding: 0.5rem 0.8rem;
    }
    
    .mobile-menu {
        padding: 1rem;
    }
    
    .mobile-link {
        padding: 0.8rem;
    }
}

