/* Estilos para la página de inicio post-login */

html, body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: #F5EBD2;
}

* {
    box-sizing: border-box;
}

/* Prevenir que elementos se salgan del viewport */
img {
    max-width: 100%;
    height: auto;
}

/* Header */
.header {
    background-color: #C81E2D;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
}
.profile-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
  }
  
  .profile-alert {
    position: absolute;
    top: 0;
    right: 0;
    background: red;
    color: white;
    font-size: 10px;
    border-radius: 50%;
    padding: 2px 5px;
  }
  

.logo-section h1 {
    color: #503214;
    font-size: 1.8rem;
    font-weight: bold;
}
.vip-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
}
/* Sección de búsqueda */
.search-section {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
}

.search-container {
    position: relative;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    background-color: white;
    color: #503214;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(245, 235, 210, 0.5);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #503214;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}

.search-btn:hover {
    background-color: #F5EBD2;
}

/* Sección de usuario */
.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    color: rgb(0, 0, 0);
    font-size: 1rem;
}

.cart-btn, .logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.cart-btn {
    background-color: #F5EBD2;
    color: #503214;
    position: relative;
}

.cart-btn:hover {
    background-color: white;
    transform: translateY(-2px);
}

.cart-count {
    background-color: #C81E2D;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.8rem;
    min-width: 20px;
    text-align: center;
}

.logout-btn {
    background-color: #503214;
    color: white;
}

.logout-btn:hover {
    background-color: #3d2610;
    transform: translateY(-2px);
}

/* Carrito desplegable */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: #C81E2D;
    color: white;
}

.cart-header h3 {
    font-size: 1.5rem;
}

.close-cart {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
}


.close-cart:hover {
    background-color: rgba(255,255,255,0.2);
}
.close-modal {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    position: absolute;
    top: 0;
    right: 0;
    margin: 1rem;
}
.close-modal:hover{
    background-color: rgba(255,255,255,0.2);
}

.cart-items {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.empty-cart {
    text-align: center;
    color: #999;
    margin-top: 2rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

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

.cart-item-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: #C81E2D;
    font-weight: bold;
}

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

.quantity-btn {
    background-color: #F5EBD2;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background-color: #C81E2D;
    color: white;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 2px solid #F5EBD2;
    background-color: #f9f9f9;
}

.cart-total {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background-color: #C81E2D;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.checkout-btn:hover {
    background-color: #a01729;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contenido principal */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    overflow-x: hidden;
}

/* Sección de categorías */
.categories-section {
    margin-bottom: 3rem;
}

.categories-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: #503214;
    margin-bottom: 2rem;
}

.categories-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.category-btn {
    padding: 10px 20px;
    border: 2px solid #C81E2D;
    background-color: white;
    color: #C81E2D;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.category-btn:hover,
.category-btn.active {
    background-color: #C81E2D;
    color: white;
    transform: translateY(-2px);
}

/* Sección de productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 100%;
}

.product-card {
    background-color: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #503214;
    margin-bottom: 0.5rem;
}

.product-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #C81E2D;
    margin-bottom: 1rem;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background-color: #C81E2D;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
    background-color: #a01729;
    transform: translateY(-2px);
}

/* Productos ocultos por filtro */
.product-card.hidden {
    display: none;
}



/* Responsive */
/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
============================================ */

/* Tablets grandes y escritorios pequeños */
@media (max-width: 1024px) {
    .main-content {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .search-section {
        max-width: 350px;
    }
}

/* Tablets */
/* Animaciones suaves en móvil */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MEJORAS HEADER RESPONSIVE
============================================ */

.brand-name {
    transition: font-size 0.3s ease;
}

.logout-text {
    display: inline;
}

/* Tablets y menores */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0.5rem;
    }
    
    .navbar {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 
            "logo user user"
            "search search search";
        gap: 0.75rem;
        align-items: center;
    }
    
    .logo-section {
        grid-area: logo;
        gap: 0.5rem;
    }
    
    .search-section {
        grid-area: search;
        max-width: 100%;
        margin: 0;
    }
    
    .user-section {
        grid-area: user;
        justify-self: end;
    }
    
    .brand-name {
        font-size: 1.3rem;
    }
    
    .welcome-text {
        display: none;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0.5rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .brand-name {
        font-size: 1.1rem;
    }
    
    .search-input {
        font-size: 0.9rem;
        padding: 10px 45px 10px 14px;
    }
    
    .user-section {
        gap: 0.4rem;
    }
    
    .cart-btn, .profile-btn, .logout-btn {
        padding: 7px 10px;
    }
    
    .cart-btn svg,
    .profile-btn svg,
    .logout-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .logout-text {
        display: none;
    }
    
    .cart-count {
        font-size: 0.7rem;
        padding: 2px 5px;
        min-width: 18px;
    }
}

@media (max-width: 480px) {
    .logo {
        height: 35px;
    }
    
    .brand-name {
        font-size: 1rem;
    }
    
    .search-input {
        font-size: 0.85rem;
        padding: 8px 40px 8px 12px;
    }
    
    .user-section {
        gap: 0.3rem;
    }
    
    .cart-btn, .profile-btn, .logout-btn {
        padding: 6px 8px;
    }
}

/* Landscape móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        grid-template-columns: auto minmax(200px, 400px) auto;
        grid-template-areas: "logo search user";
        gap: 1rem;
    }
    
    .brand-name {
        font-size: 1.1rem;
    }
    
    .search-section {
        max-width: 400px;
    }
}
.brand-name {
    transition: font-size 0.3s ease;
}

.logout-text {
    display: inline;
}

/* Tablets y menores */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0.5rem;
    }
    
    .navbar {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 
            "logo user user"
            "search search search";
        gap: 0.75rem;
        align-items: center;
    }
    
    .logo-section {
        grid-area: logo;
        gap: 0.5rem;
    }
    
    .search-section {
        grid-area: search;
        max-width: 100%;
        margin: 0;
    }
    
    .user-section {
        grid-area: user;
        justify-self: end;
    }
    
    .brand-name {
        font-size: 1.3rem;
    }
    
    .welcome-text {
        display: none;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0.5rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .brand-name {
        font-size: 1.1rem;
    }
    
    .search-input {
        font-size: 0.9rem;
        padding: 10px 45px 10px 14px;
    }
    
    .user-section {
        gap: 0.4rem;
    }
    
    .cart-btn, .profile-btn, .logout-btn {
        padding: 7px 10px;
    }
    
    .cart-btn svg,
    .profile-btn svg,
    .logout-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .logout-text {
        display: none;
    }
    
    .cart-count {
        font-size: 0.7rem;
        padding: 2px 5px;
        min-width: 18px;
    }
}

@media (max-width: 480px) {
    .logo {
        height: 35px;
    }
    
    .brand-name {
        font-size: 1rem;
    }
    
    .search-input {
        font-size: 0.85rem;
        padding: 8px 40px 8px 12px;
    }
    
    .user-section {
        gap: 0.3rem;
    }
    
    .cart-btn, .profile-btn, .logout-btn {
        padding: 6px 8px;
    }
}

/* Landscape móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        grid-template-columns: auto minmax(200px, 400px) auto;
        grid-template-areas: "logo search user";
        gap: 1rem;
    }
    
    .brand-name {
        font-size: 1.1rem;
    }
    
    .search-section {
        max-width: 400px;
    }
}