/* Estilos del Catálogo Público (Cliente Final) - Mobile First */

:root {
    --bg-dark: #090d16;
    --bg-card: #121824;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-color: #38bdf8;
    --accent-glow: 0 0 15px rgba(56, 189, 248, 0.4);
    --accent-hover: #0ea5e9;
    
    --whatsapp-green: #10b981;
    --whatsapp-glow: 0 0 15px rgba(16, 185, 129, 0.4);
    
    --font-sans: 'Outfit', sans-serif;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    padding-bottom: 80px; /* Espacio para el pie de página / botón flotante */
    background-image: 
        radial-gradient(at 50% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(79, 70, 229, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
}

/* --- CABECERA COMERCIO --- */

.client-header {
    position: relative;
    padding: 50px 20px 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(9, 13, 22, 0.4) 0%, var(--bg-dark) 100%);
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
}

.store-logo-wrapper {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin: 0 auto 15px auto;
    border: 2px solid var(--accent-color);
    box-shadow: var(--accent-glow);
    padding: 3px;
    background: var(--bg-dark);
    overflow: hidden;
}

.store-logo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.store-name {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.catalog-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.catalog-description {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 450px;
    margin: 0 auto 15px auto;
}

/* Botones de formato descarga */
.download-formats-header {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.format-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.format-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.format-btn i.fa-file-pdf {
    color: #ef4444;
}

.format-btn i.fa-file-excel {
    color: #10b981;
}

/* --- BUSCADOR --- */

.search-bar-wrapper {
    position: sticky;
    top: 0;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    z-index: 5;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

#search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 12px 16px 12px 42px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    border-radius: 12px;
    outline: none;
    transition: var(--transition-smooth);
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

/* --- PRODUCTOS GRID --- */

.products-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.loading-spinner, 
.no-products {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.no-products i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    animation: fadeIn 0.3s ease-out;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 15px;
    align-items: center;
    position: relative;
    transition: var(--transition-smooth);
}

.product-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.product-image-wrapper {
    width: 85px;
    height: 85px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-wrapper i {
    font-size: 30px;
    color: var(--text-muted);
}

.product-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 40px; /* Espacio para el botón de agregar */
}

.product-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.product-details .description {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-details .stock-badge {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.product-details .price {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

/* Botón Añadir a Carrito en Ficha */
.add-to-cart-btn {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    border: none;
    color: #000;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.25);
}

.add-to-cart-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: var(--accent-glow);
}

/* Botón Flotante del Carrito */
.cart-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    border: none;
    color: #000;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cart-float-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.08);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--whatsapp-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: var(--whatsapp-glow);
    border: 2px solid var(--bg-dark);
}

/* --- MODAL DEL CARRITO --- */

.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 16, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: flex-end; /* Bottom sheet en móviles */
    justify-content: center;
    opacity: 1;
    transition: var(--transition-smooth);
}

.cart-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.cart-modal-content {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 80%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-modal.hidden .cart-modal-content {
    animation: none;
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-modal-header h3 i {
    color: var(--accent-color);
}

.close-cart {
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.cart-items-list {
    overflow-y: auto;
    flex-grow: 1;
    margin-bottom: 20px;
    max-height: 300px;
}

/* Item del Carrito */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-details {
    flex-grow: 1;
    padding-right: 15px;
}

.cart-item-details h4 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.cart-item-details .price {
    font-size: 13px;
    color: var(--accent-color);
    font-weight: 500;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.cart-item-qty {
    font-size: 14px;
    font-weight: 600;
    width: 15px;
    text-align: center;
}

.cart-total-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    font-size: 16px;
    font-weight: 700;
    border-top: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.cart-total-price {
    font-size: 20px;
    color: var(--accent-color);
}

.send-order-btn {
    background: var(--whatsapp-green);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition-smooth);
    box-shadow: var(--whatsapp-glow);
}

.send-order-btn:hover {
    background: #059669;
    box-shadow: 0 0 20px rgba(5, 150, 105, 0.5);
}

/* --- FOOTER CLIENTE --- */

.client-footer {
    text-align: center;
    padding: 40px 20px 20px 20px;
    font-size: 11px;
    color: var(--text-muted);
}

.client-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* --- MEDIA QUERIES --- */
@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .cart-modal {
        align-items: center;
    }
    
    .cart-modal-content {
        border-radius: 20px;
        max-height: 90%;
    }
}

@media (min-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
    
    .product-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .product-image-wrapper {
        width: 100%;
        height: 150px;
    }
    
    .product-details {
        padding-right: 0;
        margin-top: 10px;
    }
}

/* --- ESTILOS PARA DISEÑO SIN FOTO (LISTADO COMPACTO) --- */
.products-grid.layout-sin-foto {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
}

@media (min-width: 768px) {
    .products-grid.layout-sin-foto {
        grid-template-columns: 1fr 1fr !important;
        gap: 15px !important;
    }
}

.product-card.card-sin-foto {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 16px !important;
    min-height: auto !important;
    background: var(--bg-card) !important;
    border-radius: 12px !important;
}

.product-card.card-sin-foto .product-details {
    padding-right: 0 !important;
    margin-top: 0 !important;
    flex-grow: 1 !important;
}

@media (min-width: 900px) {
    .products-grid.layout-sin-foto .product-card.card-sin-foto {
        flex-direction: row !important;
        align-items: center !important;
    }
    .products-grid.layout-sin-foto .product-card.card-sin-foto .product-details {
        margin-top: 0 !important;
    }
}
