@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Paleta de Colores - Estilo Lambertucci (Minimalista y Clásico) */
    --color-primary: #1A1A1A;
    /* Negro Oscuro (Botones, Títulos) */
    --color-primary-hover: #333333;
    --color-secondary: #D4AF37;
    /* Dorado (Acentos, "Compra & Venta") */
    --color-background: #FCFCFC;
    /* Blanco con toque cálido/crema */
    --color-surface: #FFFFFF;
    --color-text-main: #1A1A1A;
    --color-text-muted: #666666;
    --color-border: #E5E5E5;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;

    /* Sombras y Efectos Glassmorphism */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;

    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-background);
    color: var(--color-text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

html {
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
    outline: none;
}

/* Dropdown Usuario Navbar (Puro CSS - Sin JS) */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.user-dropdown-content {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    background-color: var(--color-surface);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    z-index: 9999;
    overflow: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.user-dropdown:hover .user-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-content a {
    color: var(--color-text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: var(--transition-short);
    border-bottom: 1px solid var(--color-border);
}

.user-dropdown-content a:last-child {
    border-bottom: none;
    color: #ef4444;
    /* Rojo para cerrar sesión */
}

.user-dropdown-content a:hover {
    background-color: #f8f9fa;
}

.user-dropdown-content i {
    margin-right: 8px;
    font-size: 1.1rem;
    vertical-align: middle;
}

/* Navbar Global Estilo Lambertucci */
.navbar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.navbar-brand h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.navbar-brand span {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-secondary);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.navbar-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-item {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--color-primary);
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-outline {
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.btn-outline:hover {
    color: var(--color-secondary);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

main {
    flex-grow: 1;
}

/* Footer Global */
.footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--color-text-main);
}

.footer p,
.footer li {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-contact a {
    color: inherit;
    text-decoration: none;
}

.footer-contact a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Base Grid Configuración */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
}

.product-img {
    height: 220px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
}

.product-img img {
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img img {
    transform: scale(1.05);
}

.badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary);
    z-index: 1;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.badge.used {
    color: var(--color-warning);
}

.badge.new {
    color: var(--color-success);
}

.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0.5rem 0 1rem;
    color: var(--color-text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: auto;
}

.product-footer span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* ========================================================================= */
/* Media Queries - Responsive (Celulares y Tablets) */
/* ========================================================================= */

@media (max-width: 768px) {

    /* Reglas generales ANTI-DESBORDE para móviles */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    body,
    html {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .container {
        padding: 0 1.5rem !important;
        /* Force margin on mobile */
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Navbar Responsiva - Muestra hamburguesa, contrae links */
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 5%;
    }

    .navbar-header {
        display: flex !important;
        width: 100% !important;
    }

    .menu-toggle {
        display: block !important;
    }

    /* Ocultar enlaces por defecto en movil */
    .navbar-nav,
    .navbar-actions {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 1rem;
    }

    /* Clase activa para JS que muestra el menú */
    .navbar-nav.active,
    .navbar-actions.active {
        display: flex;
    }

    .nav-item {
        width: 100%;
        text-align: center;
        padding: 0.8rem 0;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    /* Fix para Dropdown de Usuario en Móvil (Arriba a abajo, no al costado) */
    .user-dropdown {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .user-dropdown-btn {
        justify-content: center;
        background-color: var(--color-surface);
        border: 1px solid var(--color-border);
    }

    .user-dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid var(--color-border);
        border-top: none;
        margin-top: 0;
        border-radius: 0 0 var(--border-radius-md) var(--border-radius-md);
    }

    /* Ajustar botones de usuario en el stack */
    .btn {
        width: 100%;
        justify-content: center;
    }

    .user-dropdown {
        width: 100%;
    }

    .user-dropdown-btn {
        background: transparent;
        border: none;
        color: var(--color-primary);
        font-size: 1rem;
        padding: 0.8rem 0 !important;
        justify-content: center;
        width: 100%;
    }

    .user-dropdown-btn:hover {
        background-color: transparent !important;
        color: var(--color-primary-hover) !important;
    }

    .user-dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        background: transparent;
        display: none;
        margin-top: 0.5rem;
    }

    .user-dropdown-content a {
        text-align: center;
        padding: 0.8rem 0;
        background: rgba(0, 0, 0, 0.02);
        border-bottom: 1px solid var(--color-border);
    }

    /* Mostrar menú al hacer clic nativamente en móvil (controlado por clase acotada en JS) */
    .user-dropdown.active .user-dropdown-content {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* Grilla de productos (1 por fila en celular firmemente) */
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        /* Ajustar margen para móviles */
    }

    /* Footer más compacto */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}