:root {
    --primary-green: #8dc63f;
    --dark-teal: #0F172A;
    --light-gray: #F1F5F9;
    --text-dark: #1E293B;
    --white: #ffffff;
}

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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #F8FAFC;
    overflow-x: hidden;
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* HEADER PC */
header { background: #fff; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.top-bar { background: var(--light-gray); padding: 5px 0; font-size: 0.8rem; color: #666; }
.top-bar .container { display: flex; justify-content: space-between; }
.main-header { display: grid; grid-template-columns: 150px 1fr 280px; align-items: center; gap: 1.5rem; padding: 1rem 0; }
.logo h1 { font-size: 2rem; color: var(--primary-green); font-weight: 800; cursor: pointer; }

/* SEARCH & RESULTS - MEJORADO */
.search-bar { position: relative; width: 100%; z-index: 1001; } /* Z-index para asegurar que esté sobre otros */
.search-bar input {
    width: 100%; padding: 14px 20px 14px 50px; border: 2px solid #e2e8f0; border-radius: 12px;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>') no-repeat 18px center;
    font-size: 1rem; color: #334155; transition: border-color 0.3s;
}
.search-bar input:focus { border-color: var(--primary-green); outline: none; }

.search-results-dropdown {
    position: absolute; top: calc(100% + 15px); left: -5%; width: 110%; background: #ffffff;
    z-index: 9999; max-height: 75vh; overflow-y: auto; display: none; 
    border: 1px solid #e2e8f0; padding: 30px; border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* Scrollbar personalizado para resultados */
.search-results-dropdown::-webkit-scrollbar { width: 8px; }
.search-results-dropdown::-webkit-scrollbar-track { background: #f8fafc; border-radius: 4px; }
.search-results-dropdown::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.search-results-dropdown::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.search-header-mini {
    font-size: 0.85rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 25px; border-bottom: 2px solid #f1f5f9; padding-bottom: 12px;
}

.search-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; }

.search-result-item { 
    display: flex; gap: 20px; background: #fff; 
    padding: 18px; border-radius: 15px; cursor: pointer; align-items: center;
    border: 1px solid #f1f5f9; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.search-result-item:hover { 
    background: #ffffff; border-color: var(--primary-green); transform: translateY(-3px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.search-result-item img { 
    width: 110px; height: 110px; object-fit: contain; flex-shrink: 0; 
    background: #fff; border-radius: 12px; padding: 8px; border: 1px solid #f1f5f9;
}

.search-result-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.search-result-name { 
    font-size: 1rem; font-weight: 700; color: #1e293b; 
    line-height: 1.4; margin-bottom: 6px; 
    white-space: normal; word-wrap: break-word;
}

@media (max-width: 480px) {
    .search-results-grid { grid-template-columns: 1fr; }
    .search-result-item { padding: 12px; gap: 12px; }
    .search-result-item img { width: 75px; height: 75px; }
}

.search-result-meta { font-size: 0.8rem; color: #64748b; margin-bottom: 3px; }
.search-result-stock { font-size: 0.75rem; color: #16a34a; font-weight: 700; background: #f0fdf4; padding: 4px 10px; border-radius: 6px; width: fit-content; margin-top: 6px; border: 1px solid #dcfce7; }

.search-result-price-box { text-align: right; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; min-width: 110px; }

.search-result-price { color: #ef4444; font-weight: 900; font-size: 1.1rem; }
.search-result-price sup { font-size: 0.7rem; }

.price-original { font-size: 0.8rem; text-decoration: line-through; color: #94a3b8; margin-bottom: 4px; }
.price-discount { font-size: 0.8rem; color: #ef4444; font-weight: 800; }
.discount-badge { position: absolute; top: 12px; left: 12px; background: #ef4444; color: #fff; font-size: 0.7rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; z-index: 5; box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3); }

.search-results-footer { 
    display: flex; justify-content: flex-start; padding-top: 25px; margin-top: 25px; border-top: 2px solid #f1f5f9; 
}
.btn-close-search { 
    background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; padding: 12px 35px; border-radius: 12px; 
    font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: 0.2s; 
}
.btn-close-search:hover { background: #f1f5f9; color: #ef4444; border-color: #ef4444; }
.no-search-results { text-align: center; padding: 30px; color: #64748b; font-style: italic; }

/* NAV PC */
.nav-bar { background: var(--dark-teal); }
.nav-bar ul { display: flex; list-style: none; align-items: center; }
.nav-bar ul li a { display: block; padding: 15px 20px; color: #fff; text-decoration: none; font-weight: 700; font-size: 0.9rem; text-transform: uppercase; }
.nav-separator { width: 1px; height: 25px; background: rgba(255,255,255,0.1); margin: 0 10px; }

/* HERO SLIDER */
.hero-slider { position: relative; height: 450px; overflow: hidden; background: var(--dark-teal); z-index: 10; }
.slider-container { height: 100%; width: 100%; position: relative; }
.slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; display: none; opacity: 0; transition: opacity 0.8s ease; }
.slide.active { display: flex; opacity: 1; }
.slider-nav button { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.3); color: #fff; border: none; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; z-index: 20; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; }
.prev-slide { left: 20px; } .next-slide { right: 20px; }

/* PRODUCTS PC */
.products-section { padding: 4rem 0; background: #f8fafc; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2.5rem; }
.product-card { 
    background: #fff; border-radius: 12px; padding: 1.5rem; border: 1px solid #eef2f6; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; 
    cursor: pointer; display: flex; flex-direction: column; height: 100%; box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.product-card:hover { transform: translateY(-8px); box-shadow: 0 20px 25px rgba(0,0,0,0.1); border-color: var(--primary-green); }
.product-image { width: 100%; height: 210px; object-fit: contain; margin-bottom: 1.5rem; }
.product-info { text-align: left; padding-right: 45px; }
.product-brand-img { font-size: 0.8rem; font-weight: 700; color: #444; margin-bottom: 5px; }
.product-code-label { font-size: 0.75rem; color: #64748b; margin-bottom: 2px; display: block; }
.product-title { font-size: 0.95rem; font-weight: 700; color: #1e293b; height: 2.8rem; overflow: hidden; margin-bottom: 15px; line-height: 1.3; text-transform: uppercase; }
.product-price { font-size: 1.4rem; font-weight: 800; color: #ef4444; }
.product-price sup { font-size: 0.8rem; }
.stock-label-card { font-size: 0.9rem; color: #475569; font-weight: 500; }
.card-actions { position: absolute; right: 12px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.card-action-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: #f8fafc; color: #64748b; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }

/* MARCAS MODAL */
.brands-search-container { max-width: 400px; margin: 0 auto 20px auto; }
.brands-search-container input { width: 100%; padding: 10px 20px; border: 1px solid #ddd; border-radius: 30px; font-size: 0.9rem; }
.alphabet-grid { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px 0; margin-bottom: 20px; border-bottom: 1px solid #eee; }
.brand-letter-btn { flex: 0 0 auto; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; background: #f8fafc; border: 1px solid #eef2f6; border-radius: 8px; font-size: 0.85rem; font-weight: 700; color: #64748b; cursor: pointer; }
.brand-letter-btn.active { background: var(--primary-green); color: #fff; }
.brands-menu-grid { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 20px; padding: 15px 5px; }
.brand-item-logo { flex: 0 0 120px; text-align: center; cursor: pointer; background: #fff; padding: 15px; border-radius: 12px; border: 1px solid #eee; transition: 0.3s; }
.brand-item-logo img { width: 80px; height: 80px; object-fit: contain; margin-bottom: 8px; }
.brand-item-logo p { font-size: 0.75rem; font-weight: 700; color: #475569; margin: 0; }

/* SIDEBAR & OVERLAY */
.category-sidebar { position: fixed; left: -320px; top: 0; width: 320px; height: 100%; background: #fff; z-index: 6000; transition: all 0.4s; box-shadow: 10px 0 30px rgba(0,0,0,0.1); display: flex; flex-direction: column; }
.category-sidebar.active { left: 0; }
.sidebar-header { background: var(--dark-teal); color: #fff; padding: 25px; font-size: 1.1rem; font-weight: 800; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
#sidebar-categories-list { list-style: none; padding: 15px 0; overflow-y: auto; flex: 1; }
.category-item-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 25px; transition: 0.2s; border-left: 4px solid transparent; }
.category-item-row:hover { background: #f8fafc; border-left-color: var(--primary-green); }
.category-item-row a { text-decoration: none; color: #334155; font-weight: 700; font-size: 0.95rem; text-transform: uppercase; flex: 1; }

/* SUBMENÚS (SUBCATEGORÍAS) */
.submenu {
    list-style: none; background: #fafafa; max-height: 0; overflow: hidden; 
    transition: all 0.3s ease-in-out; padding-left: 0; border-left: 2px solid #eee; margin-left: 25px;
}
.submenu.active { max-height: 1000px; margin-top: 5px; margin-bottom: 10px; padding: 5px 0; }
.submenu li a {
    display: block; padding: 8px 20px; color: #64748b; text-decoration: none;
    font-size: 0.9rem; font-weight: 400; text-transform: capitalize; transition: 0.2s;
}
.submenu li a:hover { color: var(--primary-green); background: #f8fafc; padding-left: 25px; }

.toggle-submenu { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #94a3b8; transition: 0.3s; font-size: 0.8rem; border-radius: 50%; }
.toggle-submenu:hover { background: #f1f5f9; color: var(--primary-green); }

.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: none; z-index: 5500; }
.sidebar-overlay.active { display: block; }

/* MODALS */
.product-modal, .auth-modal { display: none; position: fixed; z-index: 5000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); overflow-y: auto; }
.product-modal-content { background: #fff; margin: 5vh auto; width: 90%; max-width: 1000px; border-radius: 15px; position: relative; padding: 20px; }
.close-modal, .close-auth { position: absolute; right: 20px; top: 15px; font-size: 2rem; cursor: pointer; z-index: 10; }

/* FLOATING BUTTONS */
.whatsapp-float { position: fixed; bottom: 20px; right: 20px; width: 55px; height: 55px; background: #25d366; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 4500; box-shadow: 0 4px 10px rgba(0,0,0,0.2); transition: 0.3s; }
.whatsapp-float:hover { transform: scale(1.1); }
.whatsapp-float img { width: 30px; height: 30px; }

.chat-toggle-btn { position: fixed; bottom: 85px; right: 20px; width: 55px; height: 55px; background: var(--primary-green); border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; z-index: 4500; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); transition: 0.3s; }
.chat-toggle-btn:hover { transform: scale(1.1); background: #7ab32f; }
.chat-toggle-btn img { width: 25px; height: 25px; filter: brightness(0) invert(1); }

/* LIVE CHAT WINDOW */
.live-chat-window { 
    position: fixed; bottom: 150px; right: 20px; width: 320px; height: 450px; 
    background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border-radius: 15px; 
    display: none; flex-direction: column; z-index: 5000; overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: fadeIn 0.3s ease;
}

.chat-header { 
    background: var(--dark-teal); color: #fff; padding: 15px 20px; 
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.95rem;
}

#chat-pre-form { padding: 25px; display: flex; flex-direction: column; gap: 12px; }
#chat-pre-form input, #chat-pre-form select {
    width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 0.9rem;
}

.chat-messages-area {
    flex: 1; padding: 15px; overflow-y: auto; background: #f8fafc;
    display: flex; flex-direction: column; gap: 10px;
}

.chat-footer-input {
    padding: 15px; border-top: 1px solid #eee; display: flex; gap: 10px; background: #fff;
}

.chat-footer-input input {
    flex: 1; border: 1px solid #ddd; padding: 10px 15px; border-radius: 20px; font-size: 0.9rem; outline: none;
}
.chat-footer-input input:focus { border-color: var(--primary-green); }

.chat-footer-input button {
    background: var(--primary-green); color: #fff; border: none; width: 40px; height: 40px; 
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.chat-footer-input button:hover { background: #7ab32f; transform: scale(1.1); }

/* Estilo para los globos de mensaje */
.msg-bubble {
    padding: 10px 15px; border-radius: 15px; max-width: 85%; font-size: 0.85rem; line-height: 1.4;
}
.msg-user { background: var(--primary-green); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-support { background: #e2e8f0; color: #1e293b; align-self: flex-start; border-bottom-left-radius: 2px; }

/* PRODUCT DETAIL RESPONSIVE */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 30px;
}

/* RESPONSIVE MÓVIL */
@media (max-width: 600px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .product-modal-content {
        width: 100%;
        margin: 0;
        height: 100%;
        border-radius: 0;
    }

    .info-column h1 {
        font-size: 1.5rem !important;
    }

    .info-column .price {
        font-size: 1.8rem !important;
    }

    .main-header { 
        display: grid; 
        grid-template-columns: 1fr auto; 
        grid-template-rows: auto auto;
        align-items: center; 
        padding: 10px; 
        height: auto; 
        gap: 10px;
    }
    
    .logo { grid-row: 1; grid-column: 1; }
    .logo h1 { font-size: 1.5rem; margin: 0; }
    
    .header-actions { grid-row: 1; grid-column: 2; }
    
    .search-bar { 
        grid-row: 2; 
        grid-column: 1 / span 2; 
        width: 100%; 
        padding: 0; 
    }

    .nav-bar { background: transparent; height: 0; }
    .products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; padding: 10px !important; }
    .product-image { height: 140px; }
    .hero-slider { height: 220px; }
    .product-card { padding: 1rem; }
    .product-info { padding-right: 35px; }

    /* Header Actions Mobile: User Icon & Alignment */
    .header-actions {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 15px;
    }

    .user-account {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .user-account span, 
    .user-account strong {
        display: none;
    }

    .user-account::before {
        content: "👤";
        font-size: 1.5rem;
        color: #334155;
    }
    
    .cart-icon .cart-btn {
        font-size: 1.5rem;
    }
}

/* FOOTER */

.main-footer { background: #fff; border-top: 1px solid #eee; padding: 60px 0 30px 0; margin-top: 60px; }

.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }

.footer-logo { color: var(--primary-green); font-size: 1.8rem; font-weight: 800; margin-bottom: 15px; }

.footer-col h4 { font-size: 1rem; font-weight: 700; margin-bottom: 20px; color: var(--dark-teal); text-transform: uppercase; }

.footer-col p, .footer-col ul li a { font-size: 0.9rem; color: #64748b; text-decoration: none; line-height: 1.8; }



.footer-bottom { border-top: 1px solid #f1f5f9; padding-top: 30px; margin-top: 30px; }

.bottom-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }



.payment-methods { display: flex; align-items: center; gap: 15px; }

.payment-methods img { 

    height: 30px; /* Tamaño controlado para los logos del footer */

    width: auto; 

    object-fit: contain;

    filter: grayscale(0.5);

    transition: 0.3s;

}

.payment-methods img:hover { filter: grayscale(0); }



/* QR EN MODAL DE PAGO (MEJORADO) */
.cart-modal-content {
    max-width: 550px !important;
    padding: 0 !important;
    border-radius: 20px !important;
    overflow: hidden;
}

/* BRAND SLIDER (INFINITE SCROLL) */
.brands-section {
    padding: 40px 0;
    background: #fff;
    border-top: 1px solid #eee;
    overflow: hidden;
}

.brands-slider {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
}

.brands-track {
    display: flex;
    width: calc(200px * 18); /* Ajustar según cantidad aprox */
    animation: scrollBrands 40s linear infinite;
}

.brand-item {
    width: 200px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
}

.brand-item img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.6;
    transition: 0.3s;
}

.brand-item img:hover {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.1);
}

@keyframes scrollBrands {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-200px * 9)); } /* Mitad del track */
}

.cart-container-inner {
    padding: 30px;
}

.cart-title {
    font-size: 1.5rem;
    color: var(--dark-teal);
    border-bottom: 3px solid var(--primary-green);
    padding-bottom: 12px;
    margin-bottom: 25px;
    font-weight: 800;
}

.cart-items-list {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 25px;
    padding-right: 10px;
}

/* Scrollbar para el carrito */
.cart-items-list::-webkit-scrollbar { width: 6px; }
.cart-items-list::-webkit-scrollbar-track { background: #f1f1f1; }
.cart-items-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

.cart-summary-box {
    border-top: 2px dashed #e2e8f0;
    padding-top: 25px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.4rem;
    font-weight: 900;
    color: #ef4444;
    margin-bottom: 20px;
}

.qr-payment-card {
    background: #f8fafc;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e2e8f0;
    text-align: center;
    margin-bottom: 25px;
}

.qr-instruction {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
}

.qr-image-wrapper {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.qr-image-main {
    width: 300px; /* Tamaño del QR aumentado */
    height: 300px;
    display: block;
    object-fit: contain;
}

.qr-help-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-green);
    line-height: 1.5;
}

.btn-whatsapp-checkout {
    width: 100%;
    background: #25d366 !important;
    color: #fff !important;
    padding: 15px !important;
    font-weight: 800 !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
    margin-bottom: 12px;
    transition: 0.3s;
}

.btn-whatsapp-checkout:hover {
    background: #1eb954 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.btn-secondary-checkout {
    width: 100%;
    background: #f1f5f9 !important;
    color: #64748b !important;
    padding: 12px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
}

/* ESTILOS DE PERFIL (MI CUENTA) */
.profile-modal-content {
    background: #f8fafc;
    padding: 0;
    overflow: hidden;
    width: 95%; /* Ancho base responsivo */
    max-width: 900px; /* Limitado a 900px para que no se estire demasiado */
    height: 75vh; /* Altura contenida */
    margin: 12.5vh auto; /* Centrado verticalmente con márgenes amplios */
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.profile-dashboard-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* SIDEBAR PERFIL */
.profile-sidebar-nav {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    overflow-y: auto;
}

.profile-user-summary {
    text-align: center;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 10px;
}

.avatar-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px auto;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.8rem; font-weight: bold;
    opacity: 0; transition: 0.3s;
}

.avatar-container:hover .avatar-overlay { opacity: 1; }

.profile-links ul { list-style: none; padding: 0 10px; }
.profile-links li { margin-bottom: 5px; }
.profile-links li a {
    display: flex; align-items: center; padding: 12px 15px;
    color: #64748b; text-decoration: none; font-weight: 600; font-size: 0.95rem;
    border-radius: 8px; transition: 0.2s;
}
.profile-links li.active a, .profile-links li a:hover {
    background: #f1f5f9; color: var(--primary-green);
}
.logout-li { margin-top: 20px; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.logout-li a { color: #ef4444 !important; }

/* CONTENIDO PRINCIPAL PERFIL */
.profile-main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f8fafc;
}

.profile-top-bar {
    display: flex; justify-content: flex-end; margin-bottom: 20px; display: none; /* Oculto en escritorio si ya está en sidebar */
}

.profile-tab-content { display: none; animation: fadeIn 0.3s ease; }
.profile-tab-content.active { display: block; }

.form-card {
    background: #fff; padding: 30px; border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03); border: 1px solid #e2e8f0;
}

.form-grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 700; color: #475569; margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 15px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 0.95rem; transition: 0.2s;
}
.form-group input:focus { border-color: var(--primary-green); outline: none; ring: 2px rgba(141, 198, 63, 0.2); }

.btn-save {
    background: var(--primary-green); color: #fff; padding: 12px 25px; border: none;
    border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 0.9rem;
}

/* RESPONSIVE PERFIL */
@media (max-width: 768px) {
    .profile-dashboard-layout { flex-direction: column; }
    .profile-sidebar-nav { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; border-bottom: 1px solid #e2e8f0; height: auto; flex: 0 0 auto; }
    .profile-user-summary { display: none; }
    .profile-links ul { display: flex; gap: 10px; width: max-content; }
    .profile-links li { margin: 0; }
    .profile-links li a { white-space: nowrap; padding: 8px 15px; font-size: 0.85rem; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .product-modal-content { height: 95vh; width: 95%; margin: 2.5vh auto; }
}

/* ESTILOS DE AUTENTICACIÓN (LOGIN/REGISTRO) */
.auth-modal-content {
    background: #fff;
    margin: 10vh auto;
    width: 95%;
    max-width: 450px; /* Tamaño compacto para login */
    border-radius: 20px;
    position: relative;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.auth-header { text-align: center; margin-bottom: 30px; }
.auth-view h2 { 
    text-align: center; 
    font-size: 1.5rem; 
    margin-bottom: 25px; 
    color: var(--dark-teal);
    font-weight: 800;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.3s;
}

.btn-auth:hover {
    background: #7ab32f;
    transform: translateY(-2px);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
    color: #64748b;
}

.auth-footer span {
    color: var(--primary-green);
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

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

.auth-view { animation: fadeIn 0.4s ease; }