/* Estilos Aesthetic para la Tienda */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap');

:root {
    --primary: #ff8fa3;
    --primary-light: #ffb5a7;
    --primary-hover: #ff758f;
    --secondary: #fff0f3;
    --text-main: #4a4e69;
    --text-muted: #9a8c98;
    --bg-main: #faf9f9;
    --card-bg: #ffffff;
    --shadow-soft: 0 10px 25px rgba(255, 143, 163, 0.1);
    --whatsapp-color: #25D366;
}

body {
    margin: 0;
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* Header Glassmorphism */
.main-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 30px rgba(255, 143, 163, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.search-bar form {
    display: flex;
    background: var(--secondary);
    border-radius: 30px;
    padding: 0.3rem 0.5rem;
    width: 100%;
    max-width: 450px;
    border: 1px solid rgba(255, 143, 163, 0.2);
}

.search-bar input {
    border: none;
    background: transparent;
    padding: 0.5rem 1.2rem;
    outline: none;
    font-family: inherit;
    font-weight: 500;
    flex: 1;
    color: var(--text-main);
}
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar button {
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.search-bar button:hover {
    transform: scale(1.05);
    background: var(--primary-hover);
}

.header-actions .cart-btn {
    position: relative;
    font-size: 1.6rem;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.3s, transform 0.3s;
    display: inline-block;
}

.header-actions .cart-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -12px;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    padding: 2px 7px;
    border: 2px solid white;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

/* Utilities / Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    font-family: inherit;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: var(--secondary); color: var(--primary); }
.btn-secondary:hover { background-color: var(--primary-light); color: white; }

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2.5rem;
}

.product-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 143, 163, 0.1);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(255, 143, 163, 0.15);
}

.product-image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    background: #fdfdfd;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s;
}

.product-card:hover .product-image-container img {
    transform: scale(1.08);
}

.product-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s;
}
.product-title:hover { color: var(--primary); }

.product-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

/* Acciones en la tarjeta (Botones en grilla) */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
}
.action-buttons-grid .btn {
    padding: 0.6rem;
    font-size: 0.9rem;
}
.direct-buy-btn {
    background-color: var(--whatsapp-color);
}
.direct-buy-btn:hover {
    background-color: #20b858;
}

/* Checkbox Aesthetic para Selección Múltiple */
.multi-select-checkbox {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}
.aesthetic-checkbox { display: none; }
.aesthetic-checkbox + label {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--primary-light);
    background: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.aesthetic-checkbox:checked + label {
    background: var(--primary);
    border-color: var(--primary);
}
.aesthetic-checkbox:checked + label::after {
    content: '✔';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Dropdown / Select Aesthetic */
.aesthetic-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    border: 2px solid var(--secondary);
    border-radius: 12px;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff8fa3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.2em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    width: 100%;
}
.aesthetic-select:hover {
    border-color: var(--primary-light);
}
.aesthetic-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 163, 0.15);
}
.aesthetic-select option {
    font-weight: 600;
    color: var(--text-main);
}

/* Barra Flotante de Acciones */
.floating-action-bar {
    position: fixed;
    bottom: -100px; /* Hidden by default */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 2000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.floating-action-bar.visible { bottom: 20px; }

.floating-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 1rem 2rem;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(255, 143, 163, 0.25);
    border: 1px solid rgba(255, 143, 163, 0.3);
    display: flex;
    align-items: center;
    gap: 2rem;
}

#selected-count-badge {
    font-weight: 700;
    color: var(--text-main);
    background: var(--secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.floating-actions {
    display: flex;
    gap: 1rem;
}
.floating-actions .btn-primary { background-color: var(--whatsapp-color); }
.floating-actions .btn-primary:hover { background-color: #20b858; }

/* Category Filters */
.category-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}
.category-filters::-webkit-scrollbar { height: 6px; }
.category-filters::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

.category-pill {
    padding: 0.6rem 1.8rem;
    background: white;
    border-radius: 25px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    white-space: nowrap;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.category-pill:hover, .category-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ── Sale / Pin Badges ──────────────────────────────────────────────── */
.product-card { position: relative; }

.sale-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #ff4d4d, #ff9a3c);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.28rem 0.75rem;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(255,77,77,0.35);
    letter-spacing: 0.5px;
    z-index: 5;
    animation: pulse-sale 2s ease-in-out infinite;
}
@keyframes pulse-sale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pin-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 1.1rem;
    z-index: 5;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Sale price display */
.price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 500;
    margin-right: 0.4rem;
}
.price-sale {
    color: #e03030;
    font-weight: 800;
    font-size: 1.15em;
}

/* Pinned card subtle highlight */
.card-pinned {
    border-color: rgba(255, 143, 163, 0.4) !important;
    box-shadow: 0 8px 30px rgba(255, 143, 163, 0.18) !important;
}
.card-boosted {
    border-color: rgba(255, 200, 100, 0.3) !important;
}

/* ── Category hierarchy navigation ─────────────────────────────────── */
.cat-nav-btn {
    font-weight: 800;
    letter-spacing: 2px;
    background: rgba(255,143,163,0.08);
    border: 2px dashed rgba(255,143,163,0.4);
    color: var(--primary) !important;
    min-width: 48px;
    justify-content: center;
    transition: all 0.25s;
}
.cat-nav-btn:hover {
    background: var(--primary);
    color: white !important;
    border-style: solid;
    transform: translateY(-2px);
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-top: 1px solid var(--secondary);
    margin-top: 4rem;
}

/* Cart Page Aesthetic */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2.5rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 143, 163, 0.1);
    transition: transform 0.3s;
}
.cart-item:hover {
    transform: translateX(5px);
}

.cart-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.cart-item-details { flex: 1; }
.cart-item-title { font-weight: 700; margin: 0 0 0.5rem 0; font-size: 1.1rem; }
.cart-item-price { color: var(--primary); font-weight: bold; font-size: 1.1rem;}

.cart-summary {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 143, 163, 0.1);
    height: fit-content;
    position: sticky;
    top: 100px;
}
.cart-summary h3 { margin-top: 0; color: var(--text-main); font-weight: 700;}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.summary-total {
    font-weight: 800;
    font-size: 1.6rem;
    border-top: 2px dashed var(--secondary);
    padding-top: 1.5rem;
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 768px) {
    .header-container { flex-direction: column; text-align: center; }
    .search-bar { width: 100%; order: 3; }
    .header-actions { order: 2; position: absolute; right: 2rem; top: 1.5rem; }
    .cart-layout { grid-template-columns: 1fr; }
    .floating-content { flex-direction: column; gap: 1rem; text-align: center; }
    
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }
    .product-card {
        padding: 0.6rem;
    }
    .product-image-container {
        height: 140px;
        margin-bottom: 0.6rem;
    }
    .product-title {
        font-size: 0.9rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        height: 2.4rem;
        line-height: 1.2rem;
    }
    .product-price {
        font-size: 1.05rem;
        margin-bottom: 0.8rem;
    }
    .action-buttons-grid {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .action-buttons-grid .btn {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    .main-content {
        padding: 0 0.8rem;
    }
    .aesthetic-select {
        padding: 0.3rem 1.8rem 0.3rem 0.6rem;
        font-size: 0.8rem;
        background-position: right 0.4rem center;
    }
    .sale-badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.4rem;
        top: 8px;
        right: 8px;
    }
    .multi-select-checkbox {
        top: 8px;
        left: 8px;
    }
    .multi-select-checkbox .aesthetic-checkbox + label {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 350px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
    .product-image-container {
        height: 200px;
    }
    .product-card {
        padding: 1.2rem;
    }
    .product-title {
        font-size: 1.1rem;
        height: auto;
    }
    .product-price {
        font-size: 1.2rem;
    }
    .action-buttons-grid {
        grid-template-columns: 1fr 1fr; /* Volver a 2 botones por fila si hay espacio a lo ancho */
    }
}
