/* Reset y base */
* { 
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f10;
    color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(90deg, #121212, #272727);
    padding: 12px 18px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 8px rgba(0,0,0,0.7);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img { 
    height: 48px; 
    width: auto; 
}

header .tabs { 
    display: inline-flex; 
    gap: 6px; 
}

header .nav-right { 
    float: right; 
    display:flex; 
    gap:10px; 
    align-items:center; 
}

/* Navegación */
nav { 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    flex-wrap:wrap; 
    gap:8px; 
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 8px;
    color: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active { 
    background: #1f1f1f; 
    border-color: #ff4655; 
    color: #ff4655; 
    transform: scale(1.02); 
}

.tab-btn:hover {
    background: #2a2a2a;
}

/* Botones de navegación */
.nav-link {
    background: transparent;
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 8px;
    color: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255,70,85,0.1);
    border-color: #ff4655;
    color: #ff4655;
}

/* Subcategorías */
.subcategories {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.3s ease;
}

.subcategories.hidden {
    display: none;
}

.subcategory-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 6px;
    color: #f5f5f5;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.subcategory-btn.active { 
    background: rgba(255,70,85,0.2); 
    border-color: #ff4655; 
    color: #ff4655; 
}

.subcategory-btn:hover {
    background: rgba(255,255,255,0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Banner */
.banner {
    height: 180px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    background: linear-gradient(180deg, rgba(255,70,85,0.08), rgba(0,0,0,0.4));
    margin-bottom: 18px;
}

.banner h2 { 
    margin:0; 
    font-size:1.4rem; 
    color:#fff; 
}

/* Productos grid */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    padding: 18px;
    max-width: 1200px;
    margin: 0 auto 80px;
    min-height: 400px;
}

.loading-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

/* Tarjeta producto */
.product-card {
    background: #181818;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
}

.product-card:hover { 
    transform: translateY(-6px); 
    box-shadow: 0 10px 28px rgba(0,0,0,0.7); 
}

.product-card img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    background: #2a2a2a;
}

.product-card h3 { 
    margin: 10px 0 6px; 
    font-size:1rem; 
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card p.price { 
    color: #00ff88; 
    font-weight:700; 
    margin: 6px 0; 
    font-size: 1.1rem;
}

/* Select y botones */
.product-card select {
    width: 100%;
    padding: 8px;
    background:#0f0f10;
    border: 1px solid #2a2a2a;
    color: #fff;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.9rem;
}

.button-container {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

button {
    background: #ff4655;
    border: none;
    padding: 10px 12px;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
}

button:hover { 
    filter:brightness(1.1); 
}

button.buy-now { 
    background: #00b894; 
}

button.buy-now:hover { 
    filter:brightness(1.1); 
}

/* Carrito */
.cart {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 300px;
    max-height: 70vh;
    overflow: auto;
    background: #121212;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.8);
    z-index: 100;
    border: 1px solid #2a2a2a;
}

.cart h3 { 
    margin: 0 0 12px; 
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#cart-list { 
    list-style:none; 
    padding:0; 
    margin:0; 
    max-height: 300px;
    overflow-y: auto;
}

#cart-list li { 
    display:flex; 
    justify-content:space-between; 
    align-items: center;
    padding: 8px 0; 
    border-bottom:1px solid rgba(255,255,255,0.1); 
}

#cart-list li span {
    flex: 1;
    margin-right: 10px;
    font-size: 0.9rem;
}

#cart-list li button {
    background: transparent;
    border: none;
    padding: 4px;
    margin: 0;
    font-size: 0.8rem;
}

#cart-total { 
    font-weight:700; 
    margin-top: 12px; 
    color:#00ff88; 
    font-size: 1.1rem;
}

#checkout-btn {
    width: 100%;
    margin-top: 12px;
    background: #00b894;
}

/* Modal - CORREGIDO */
.modal { 
    position: fixed; 
    inset:0; 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    background: rgba(0,0,0,0.8); 
    z-index:200; 
    padding: 20px;
}

.modal.hidden { 
    display:none; 
}

.modal-content { 
    width: 92%; 
    max-width: 900px; 
    background:#0f0f10; 
    border-radius:12px; 
    padding:20px; 
    box-shadow: 0 12px 36px rgba(0,0,0,0.8);
    border: 1px solid #2a2a2a;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body { 
    display:flex; 
    gap: 24px; 
    align-items:flex-start; 
}

/* IMAGEN DEL MODAL CORREGIDA - Se ajusta automáticamente */
#modal-img {
    width: 100%;
    max-width: 400px;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.modal-info { 
    flex:1; 
    min-width: 0; /* Permite que el contenido se ajuste */
}

.close-modal { 
    background: transparent; 
    border: none; 
    color: #fff; 
    font-size:1.5rem; 
    float:right; 
    cursor:pointer; 
    padding: 4px;
    margin-bottom: 10px;
}

.close-modal:hover {
    color: #ff4655;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

/* Estilos para el sistema de login */
.login-container, .register-container {
    width: 100%;
    padding: 10px;
}

.login-container h3, .register-container h3 {
    color: #ff4655;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #f5f5f5;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #f5f5f5;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #ff4655;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.8rem;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-container input {
    margin-right: 8px;
}

.forgot-password {
    color: #ff4655;
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.login-submit-btn, .register-submit-btn {
    width: 100%;
    padding: 12px;
    background: #ff4655;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease;
    margin-bottom: 16px;
}

.login-submit-btn:hover, .register-submit-btn:hover {
    filter: brightness(1.1);
}

.login-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #2a2a2a;
}

.login-divider span {
    background: #0f0f10;
    padding: 0 12px;
    color: #888;
}

.social-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.social-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s ease;
}

.social-login-btn:hover {
    background: #2a2a2a;
}

.google-btn {
    background: #1a1a1a;
}

.facebook-btn {
    background: #1a1a1a;
}

.register-link, .back-to-login {
    text-align: center;
    margin-top: 20px;
}

.register-link a, .back-to-login a {
    color: #ff4655;
    text-decoration: none;
}

.register-link a:hover, .back-to-login a:hover {
    text-decoration: underline;
}

/* Estilos para el perfil de usuario */
.profile-container {
    width: 100%;
    padding: 10px;
}

.profile-header {
    text-align: center;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4655, #ff6b7a);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 2rem;
}

.profile-header h3 {
    color: #f5f5f5;
    margin-bottom: 4px;
}

.profile-header p {
    color: #888;
    font-size: 0.9rem;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 24px;
    padding: 16px;
    background: #1a1a1a;
    border-radius: 8px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff4655;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: #888;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1a1a1a;
    border: none;
    border-radius: 8px;
    color: #f5f5f5;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.profile-menu-item:hover {
    background: #2a2a2a;
}

.profile-actions {
    text-align: center;
}

.logout-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #ff4655;
    border-radius: 8px;
    color: #ff4655;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255,70,85,0.1);
}

/* Información de contacto */
.contact-info {
    width: 100%;
    padding: 20px;
}

.contact-info h3 {
    color: #ff4655;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.contact-item {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.contact-item strong {
    color: #00ff88;
    display: block;
    margin-bottom: 5px;
}

.social-links {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.social-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 8px 12px;
    border-radius: 6px;
    color: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 120px;
}

.social-btn:hover {
    background: rgba(255,70,85,0.2);
    border-color: #ff4655;
    color: #ff4655;
}

/* Ocultos */
.hidden { 
    display:none; 
}

/* Notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00b894;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive - CORREGIDO */
@media (max-width: 780px) {
    .modal-body { 
        flex-direction: column; 
        align-items:center; 
        gap: 16px;
    }
    
    /* IMAGEN RESPONSIVE EN MÓVIL */
    #modal-img {
        width: 100%;
        max-width: 100%;
        max-height: 300px;
        object-fit: contain;
    }
    
    .products { 
        padding: 12px; 
        grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); 
    }
    
    header .nav-right { 
        gap:6px; 
    }
    
    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .cart {
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
    }
    
    .modal-content {
        padding: 16px;
        width: 95%;
        max-width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .subcategories {
        gap: 4px;
    }
    
    .subcategory-btn {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    .social-links {
        flex-direction: column;
    }
    
    .social-btn {
        min-width: auto;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .profile-stats {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .product-card {
        min-height: 350px;
        padding: 10px;
    }
    
    .product-card h3 {
        font-size: 0.9rem;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .subcategories {
        gap: 3px;
    }
    
    .subcategory-btn {
        padding: 4px 6px;
        font-size: 0.75rem;
    }
    
    .nav-link {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 98%;
        padding: 12px;
    }
    
    /* Ajuste adicional para móviles muy pequeños */
    #modal-img {
        max-height: 250px;
    }
}

/* Estilos adicionales para mejorar la visualización de imágenes */
.modal-content .modal-info h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #f5f5f5;
}

.modal-content .modal-info p {
    margin-bottom: 15px;
    line-height: 1.5;
    color: #ccc;
}

.modal-content .modal-info .price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #00ff88;
    margin-bottom: 15px;
}

.modal-content .modal-info label {
    display: block;
    margin-bottom: 8px;
    color: #f5f5f5;
    font-weight: 500;
}

.modal-content .modal-info select {
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    color: #f5f5f5;
    margin-bottom: 20px;
}