:root {
    --dark-bg: #121212;
    --card-bg: #1A1A1A;
    --primary: #FFD700;
    --secondary: #D4AF37;
    --accent: #FFD700;
    --text: #FFFFFF;
    --text-muted: #AAAAAA;
    --success: #00CC99;
    --whatsapp: #25D366;
    --card-border: rgba(255, 215, 0, 0.15);
    --card-glow: rgba(255, 215, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER MEJORADO PARA MÓVIL */
.header {
    background-color: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.header-wrap {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: var(--dark-bg);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
}

.brand-name {
    font-family: 'Apple Chancery', cursive, 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
    margin-left: auto;
}

/* BÚSQUEDA MÓVIL MEJORADA */
.search-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-container {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 600px;
    min-width: 0;
}

.search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.search .icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    z-index: 1;
}

.search input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    color: var(--text);
    width: 100%;
    transition: all 0.3s ease;
    min-width: 0;
}

.search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

/* CONTENIDO PRINCIPAL CON HEADER FIJADO */
.main-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin: 80px auto 2rem;
    max-width: 1400px;
    padding: 0 1.5rem;
    width: 100%;
    min-height: 60vh;
}

/* SIDEBAR PARA VERSIÓN PC */
.sidebar {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 3px;
}

.sidebar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    position: relative;
}

.sidebar-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 25%;
    width: 50%;
    height: 2px;
    background: var(--primary);
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chip {
    padding: 0.8rem 1.2rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chip:hover {
    background-color: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateX(5px);
}

.chip.active {
    background-color: var(--primary);
    color: var(--dark-bg);
    font-weight: 600;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.chip .count {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.chip.active .count {
    background: rgba(0, 0, 0, 0.3);
}

.filter-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 600;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-option input[type="checkbox"] {
    accent-color: var(--primary);
}

/* ÁREA DE CONTENIDO */
.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.grid {
    display: grid;
    margin-bottom: 2rem;
}

/* TARJETAS CON CONTORNOS MEJORADOS */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-border);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), transparent, var(--secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--card-glow);
}

.card:hover::before {
    opacity: 1;
}

.thumb {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .thumb img {
    transform: scale(1.05);
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--primary);
    color: var(--dark-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

.card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
}

.meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.cat {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.glow {
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.note {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* FOOTER COMPACTO Y ELEGANTE - ESTRUCTURA CORREGIDA */
footer {
    background-color: var(--card-bg);
    padding: 1.5rem 1rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.footer-section {
    text-align: left;
}

.footer-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 2px;
}

.footer-section p {
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
}

.footer-section a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.contact-item.whatsapp {
    color: var(--whatsapp);
}

.contact-item.phone {
    color: var(--text);
}

.footer-social {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    transition: all 0.3s ease;
    font-size: 1rem;
}

.footer-social a:hover {
    background: var(--primary);
    color: var(--dark-bg);
    transform: translateY(-2px);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.copyright {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.copyright-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.creator {
    color: var(--primary);
    font-weight: 500;
}

/* Para pantallas más pequeñas */
@media (max-width: 768px) {
    footer {
        padding: 1.25rem 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-section h3 {
        justify-content: center;
    }
    
    .footer-section p {
        justify-content: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .copyright-line {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Para móviles muy pequeños */
@media (max-width: 480px) {
    footer {
        padding: 1rem 0.75rem;
    }
    
    .footer-content {
        gap: 1rem;
    }
    
    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-section p {
        font-size: 0.85rem;
    }
    
    .footer-social a {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .footer-bottom {
        font-size: 0.8rem;
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

.copyright {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.creator {
    color: var(--primary);
    font-weight: 500;
}

/* BOTONES FLOTANTES */
.whatsapp-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--whatsapp);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 99;
    transition: all 0.3s ease;
    cursor: move; /* Cambia el cursor para indicar que es movible */
    user-select: none; /* Evita que se seleccione el texto */
    touch-action: none; /* Mejora el comportamiento táctil */
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

.whatsapp-float.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.8);
}

.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    width: 50px;
    height: 50px;
    background-color: var(--primary);
    color: var(--dark-bg);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-filter-btn:hover {
    transform: scale(1.1);
}

/* SIDEBAR MÓVIL */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 300px;
    height: 100%;
    background-color: var(--card-bg);
    z-index: 101;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    transition: left 0.3s ease;
    -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.mobile-sidebar.open {
    left: 0;
}

.close-sidebar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* MEJORAS RESPONSIVE */

/* VERSIÓN ESCRITORIO */
@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .mobile-filter-btn {
        display: none;
    }
}

/* VERSIÓN TABLET */
@media (min-width: 641px) and (max-width: 1023px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .main-container {
        flex-direction: column;
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .sidebar {
        display: none;
    }
    
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .thumb {
        height: 180px;
    }
}

/* VERSIÓN MÓVIL */
@media (max-width: 1023px) {
    .sidebar {
        display: none;
        width: 100%;
        position: static;
        max-height: none;
        padding: 1rem;
    }
    
    .sidebar.mobile-visible {
        display: block;
    }
    
    .sidebar-title {
        font-family: 'Playfair Display', serif;
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
        color: var(--primary);
    }
    
    .categories {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    
    .chip {
        padding: 0.75rem 1rem;
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 0.85rem;
        flex: 1;
        min-width: 120px;
        text-align: center;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chip:active {
        background: rgba(255, 215, 0, 0.2);
        transform: scale(0.98);
    }
    
    .chip.active {
        background-color: var(--primary);
        color: var(--dark-bg);
        font-weight: 600;
    }
    
    .mobile-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 56px;
        bottom: 5rem;
    }
    
    .whatsapp-float {
        width: 56px;
        height: 56px;
        bottom: 1rem;
        right: 1rem;
    }
    
    /* MEJORAS DE USABILIDAD TÁCTIL */
    button, .chip, .card {
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        user-select: none;
    }
    
    .card:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .card:active {
        transform: scale(0.98);
    }
    
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* VERSIÓN MÓVIL PEQUEÑA (≤ 640px) - CORREGIDA */
@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .header-wrap {
        flex-direction: row;
        align-items: center;
    }
    
    .brand {
        flex: 1;
    }
    
    .header-actions {
        flex: 0 0 auto;
    }
    
    .search-container {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    
    .search-container.active {
        transform: translateY(0);
    }
    
    .search-toggle {
        display: flex;
    }
    
    .search-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .search-close {
        background: none;
        border: none;
        color: var(--text);
        font-size: 1.2rem;
        cursor: pointer;
    }
    
    .main-container {
        margin-top: 70px;
        padding: 0 1rem;
    }
    
    .thumb {
        height: 140px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .title {
        font-size: 0.9rem;
        line-height: 1.3;
        /* REMOVIDO: Propiedades problemáticas de webkit */
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        white-space: nowrap;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-section h3 {
        justify-content: center;
    }
    
    .footer-section p {
        justify-content: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .contact-item {
        justify-content: center;
    }
    
    .copyright {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* MÓVILES MUY PEQUEÑOS (≤ 480px) */
@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0.75rem;
    }
    
    .main-container {
        margin-top: 65px;
        padding: 0 0.75rem;
    }
    
    .grid {
        gap: 0.75rem;
    }
    
    .thumb {
        height: 120px;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .title {
        font-size: 0.85rem;
        white-space: normal;
        line-height: 1.2;
        max-height: 2.4em;
        overflow: hidden;
    }
    
    .price {
        font-size: 0.9rem;
    }
    
    .mobile-filter-btn,
    .whatsapp-float {
        width: 52px;
        height: 52px;
    }
    
    .mobile-filter-btn {
        bottom: 4.5rem;
    }
    
    .chip {
        min-width: calc(50% - 0.2rem);
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }
    
    /* FOOTER PARA MÓVILES PEQUEÑOS */
    footer {
        padding: 1.25rem 0.75rem;
    }
    
    .footer-content {
        gap: 1.25rem;
    }
    
    .footer-section h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-section p {
        font-size: 0.85rem;
    }
    
    .contact-item {
        font-size: 0.85rem;
    }
    
    .footer-social a {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .footer-bottom {
        font-size: 0.8rem;
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

/* MEJORAS PARA PANTALLAS GRANDES */
@media (min-width: 1600px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* ANIMACIONES */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid > div {
    animation: slideInUp 0.4s ease forwards;
}

/* SCROLL SUAVE */
html {
    scroll-behavior: smooth;
}

/* INDICADOR DE CARGA PARA MÓVIL */
.loading-indicator {
    display: none;
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
}

.loading-indicator.active {
    display: block;
}