/* Reset básico y variables */
:root {
    --primary-dark: #0b132b;
    --secondary-dark: #1c2541;
    --accent: #5bc0be;
    --text-dark: #3a506b;
    --background: #f4f4f4;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(45deg, #667eea, #764ba2);
    --gradient-danger: linear-gradient(45deg, #ff6b6b, #ee5a24);
    --shadow-light: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-medium: 0 8px 25px rgba(0,0,0,0.15);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.2);
    --border-radius: 15px;
    --border-radius-sm: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    line-height: 1.6;
}

/* Header */
.main-header {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-light);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    width: 40px;
    margin-right: 0.8rem;
}

.main-nav a {
    margin: 0 1rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-block;
    position: relative;
}

.main-nav a:hover {
    color: var(--accent);
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.main-nav a:hover::after {
    width: 80%;
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.5rem;
    color: white;
    margin: 0;
    font-weight: 700;
}

.user-info {
    font-size: 0.95rem;
     position: relative;
}

.user-info a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.user-dropdown-trigger {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-dropdown-trigger:hover {
    background: rgba(255,255,255,0.1);
}

.dropdown-menu {
    display: none;
    position: relative;
    right: 0;
    top: 100%;
    background-color: var(--white);
    color: var(--primary-dark);
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    min-width: 200px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--primary-dark);
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s;
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-dark);
    text-decoration: none;
}

.dropdown-item.logout-link {
    color: #dc3545;
    border-bottom: none;
}

.dropdown-item.logout-link:hover {
    background-color: #dc3545;
    color: white;
}

.cart-link {
    position: relative;
}

#cart-counter {
    font-weight: bold;
    color: var(--accent);
}

/* Responsive Design for Header */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .main-nav {
        text-align: center;
        order: 3;
        width: 100%;
    }

    .main-nav a {
        display: block;
        margin: 0.5rem 0;
        padding: 0.75rem 1rem;
        text-align: center;
    }

    .user-info {
        order: 2;
        width: 100%;
        text-align: center;
        justify-content: center;
        align-items: center;
        display: flex;
    }

    .logo-container {
        justify-content: center;
        order: 1;
    }

    .dropdown-menu {
        right: auto;
        left: 0;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 1.2rem;
    }
    
    .main-nav a {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .user-dropdown-trigger {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

.user-info a:hover {
    text-decoration: underline;
}

/* Hero Section */
.hero-section {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 4rem 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-bottom: 3rem;
    text-align: center;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-section .lead {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Search */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.search-form {
    position: relative;
}

.search-form .form-control {
    border-radius: 25px;
    padding: 12px 130px 12px 20px;
    border: none;
    font-size: 1rem;
    box-shadow: var(--shadow-light);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: var(--gradient-accent);
    color: var(--white);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: var(--shadow-medium);
}

/* Product Cards */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    box-shadow: var(--shadow-light);
    height: 100%;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer; /* Esta línea es crucial */
}

.product-card[role="button"] {
    cursor: pointer;
}

/* Asegurar que los botones dentro de las tarjetas tengan cursor pointer */
.product-card .btn-modern,
.product-card .add-to-cart,
.product-card .buy-now {
    cursor: pointer !important;
}

/* Evitar que los botones hereden el cursor de la tarjeta */
.product-card .btn-modern:hover,
.product-card .add-to-cart:hover,
.product-card .buy-now:hover {
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-image {
    height: 180px;
    object-fit: cover;
    width: 100%;
}

.product-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 0.95rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-card .card-text {
    color: var(--text-dark);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Buttons */
.btn-modern {
    background: var(--gradient-accent);
    border: none;
    color: var(--white);
    padding: 10px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: var(--white);
}

.btn-outline-primary {
    border: 2px solid var(--accent);
    color: var(--accent);
    font-weight: 600;
    border-radius: 25px;
    padding: 8px 20px;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: var(--accent);
    color: var(--white);
    transform: translateY(-2px);
}

/* Features */
.features {
    padding: 3rem 0;
}

.feature-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease;
    height: 100%;
    border: none;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.feature-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-card h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-dark);
}

/* Filter Section */
.filter-section {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-light);
}

.filter-section .form-label {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.filter-section .form-control,
.filter-section .form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
}

.filter-section .form-control:focus,
.filter-section .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(91, 192, 190, 0.25);
}

/* Section Titles */
.section-title {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin: 2rem 0 1rem;
    color: var(--primary-dark);
}

/* Badges */
.badge-promocion {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--gradient-danger);
    color: white;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
}

.rating-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 193, 7, 0.95);
    color: var(--primary-dark);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item.active {
    color: var(--text-dark);
}

/* Pagination */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--accent);
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    margin: 0 2px;
}

.page-item.active .page-link {
    background: var(--gradient-accent);
    border-color: var(--accent);
}

.page-link:hover {
    color: var(--accent);
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* Footer */
.main-footer {
    background-color: var(--primary-dark);
    color: var(--white);
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 4rem;
}

.main-footer .list-inline-item a {
    color: var(--white);
    text-decoration: none;
    transition: color 0.3s;
}

.main-footer .list-inline-item a:hover {
    color: var(--accent);
}

/* Cart Styles */
.cart-item-card {
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-light);
    background-color: var(--white);
}

.cart-item-card .card-title {
    color: var(--primary-dark);
}

.update-cart-quantity {
    text-align: center;
    border-radius: var(--border-radius-sm);
    border: 1px solid #e0e0e0;
}

.update-cart-quantity:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(91, 192, 190, 0.25);
}

.delete-cart-item {
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 1;
    font-size: 1rem;
    padding: 0;
    border-width: 1px;
}

.checkout-summary-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 20px;
}

.checkout-summary-card h3 {
    color: var(--primary-dark);
}

.summary-details p {
    margin-bottom: 0.8rem;
    color: var(--text-dark);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-dark);
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .main-nav {
        text-align: center;
    }

    .main-nav a {
        display: block;
        margin: 0.5rem 0;
        padding: 0.75rem 1rem;
        text-align: center;
    }

    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .lead {
        font-size: 1.1rem;
    }

    .search-form .form-control {
        padding: 10px 110px 10px 15px;
        font-size: 0.9rem;
    }

    .search-btn {
        padding: 6px 15px;
        font-size: 0.9rem;
    }

    .feature-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .filter-section {
        padding: 1rem;
    }

    .product-image {
        height: 150px;
    }

    .btn-modern {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 1.8rem;
    }
    
    .search-form .form-control {
        padding: 8px 100px 8px 12px;
    }
    
    .search-btn {
        padding: 5px 12px;
        font-size: 0.85rem;
    }
    
    .product-card .card-body {
        padding: 0.75rem;
    }
}
/* Mejoras de interactividad para tarjetas */
.product-card[role="button"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.product-card[role="button"]:focus:not(:focus-visible) {
    outline: none;
}

.product-card[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Estados hover y active mejorados */
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-card:active {
    transform: translateY(-2px);
    transition: transform 0.1s ease;
}

/* Asegurar que los botones sean claramente clickeables */
.btn-modern, .add-to-cart, .buy-now {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Mejorar la apariencia de los enlaces del header */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .product-card {
        cursor: pointer; /* Asegurar cursor en móvil */
    }
    
    .nav-link {
        cursor: pointer;
    }
    
    /* Mejorar el tamaño de tap en móvil */
    .btn-modern, .add-to-cart, .buy-now {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.main-nav a.nav-link {
    margin: 0 1rem;
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: inline-block;
    position: relative;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
}

.main-nav a.nav-link:hover {
    color: var(--accent);
    background: rgba(255,255,255,0.1);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Asegurar que los enlaces sean clickeables en móvil */
@media (max-width: 768px) {
    .main-nav a.nav-link {
        display: block;
        margin: 0.5rem 0;
        padding: 0.75rem 1rem;
        text-align: center;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Prevenir que el header interfiera con los clics */
.main-header {
    z-index: 1000;
    position: relative;
}

/* Mejorar el área de tap en móvil para botones */
.btn-modern, .add-to-cart, .buy-now {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
}

/* Asegurar que las tarjetas sean clickeables */
.product-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.product-card * {
    pointer-events: none;
}

.product-card .btn-modern,
.product-card .add-to-cart, 
.product-card .buy-now {
    pointer-events: auto !important;
}

html {
  touch-action: manipulation;
}

/* ===== HEADER COMPACTO EN MÓVILES ===== */
@media (max-width: 768px) {
    .main-header {
        padding: 0.4rem 1rem;
        min-height: 55px;
        gap: 0.5rem;
    }
    
    .logo-container {
        order: 1;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .logo {
        width: 32px;
        margin-right: 0.5rem;
    }
    
    .user-info {
        order: 2;
        margin-left: auto;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .main-nav a.nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        min-height: 40px;
        margin: 0.25rem 0;
    }
    
    .user-dropdown-trigger {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .dropdown-menu {
        min-width: 180px;
        margin-top: 0.25rem;
    }
}

/* ===== ANIMACIÓN SUAVE PARA FLECHAS DE DROPDOWN ===== */
.user-dropdown-trigger {
    position: relative;
    transition: all 0.3s ease;
}

.user-dropdown-trigger::after {
    content: '';
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 0.5em;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
}

/* Estado cuando el dropdown está abierto */
.user-dropdown-trigger.active::after,
.user-dropdown-trigger.show::after {
    transform: rotate(-135deg) translateY(-1px);
}

/* Efecto hover para el trigger del dropdown */
.user-dropdown-trigger:hover::after {
    transform: rotate(45deg) scale(1.1);
}

.user-dropdown-trigger.active:hover::after,
.user-dropdown-trigger.show:hover::after {
    transform: rotate(-135deg) scale(1.1) translateY(-1px);
}

/* ===== MEJORAS PARA DROPDOWN EN MÓVILES ===== */
@media (max-width: 768px) {
    .user-dropdown-trigger::after {
        width: 0.35em;
        height: 0.35em;
        margin-left: 0.4em;
    }
    
    .dropdown-menu {
        border: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        border-radius: var(--border-radius-sm);
        animation: dropdownFadeIn 0.2s ease-out;
    }
    
    .dropdown-item {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        transition: all 0.2s ease;
    }
    
    .dropdown-item:active {
        background-color: var(--accent);
        color: white;
        transform: translateX(5px);
    }
}

/* Animación de entrada para dropdown */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HEADER EXTRA COMPACTO EN PANTALLAS MUY PEQUEÑAS ===== */
@media (max-width: 480px) {
    .main-header {
        padding: 0.3rem 0.8rem;
        min-height: 50px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .logo {
        width: 28px;
    }
    
    .main-nav a.nav-link {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
        min-height: 38px;
    }
    
    .user-dropdown-trigger {
        padding: 0.35rem 0.7rem;
        font-size: 0.85rem;
        min-height: 38px;
    }
    
    .user-dropdown-trigger::after {
        width: 0.3em;
        height: 0.3em;
    }
}

/* ===== MEJORA VISUAL PARA ESTADO ACTIVO DEL HEADER ===== */
.main-header {
    transition: all 0.3s ease;
    z-index: 1000;
    position: relative;
}

/* ===== EFECTO SUTIL AL HACER SCROLL (OPCIONAL) ===== */
.main-header.scrolled {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ===== MEJORA DE ACCESIBILIDAD PARA DROPDOWN ===== */
.user-dropdown-trigger:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.user-dropdown-trigger:focus:not(:focus-visible) {
    outline: none;
}

/* Estilos mejorados para banners con imágenes */
.banner-horizontal img,
.banner-vertical img {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.banner-horizontal img:hover,
.banner-vertical img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.banner-horizontal {
    background: transparent;
    border: 2px dashed #dee2e6;
    padding: 1rem;
}

.banner-vertical {
    background: transparent;
    border: 2px dashed #dee2e6;
    padding: 1rem;
}

/* Estilos para el panel de administración de banners */
.admin-stats .card {
    transition: transform 0.2s ease;
}

.admin-stats .card:hover {
    transform: translateY(-2px);
}

.table-responsive {
    border-radius: 10px;
}

.banner-preview {
    max-width: 100%;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

/* Responsive para el panel admin */
@media (max-width: 768px) {
    .admin-stats .col-md-3 {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .logo-text, 
    .navbar-brand, 
    .logo-link {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        cursor: pointer;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .product-card {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        touch-action: pan-y;
    }
    
    .add-to-cart, 
    .buy-now {
        -webkit-tap-highlight-color: rgba(91, 192, 190, 0.2);
        touch-action: manipulation;
    }
}

/* Prevenir zoom en inputs en iOS */
@media (max-width: 768px) {
    input, 
    select, 
    textarea {
        font-size: 16px; /* Previene zoom en iOS */
    }
}

/* Mejorar área de toque para elementos interactivos */
.add-to-cart, 
.buy-now, 
.product-card[role="button"] {
    min-height: 44px;
}

.logo-text,
.navbar-brand {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 8px 12px;
}