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

:root {
    --primary: #4ade80;
    --primary-dark: #22c55e;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-hover: #1a1a1a;
    --text: #ffffff;
    --text-muted: #a1a1aa;
    --text-light: #71717a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.5;
}

.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(74, 222, 128, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* HOME VIEW */
#homeView {
    overflow-y: auto;
}

.hero {
    background: linear-gradient(180deg, #111111 0%, var(--bg-dark) 100%);
    padding: 4rem 1.5rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    color: var(--primary);
}

.hero p {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.container {
    padding: 2rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
    letter-spacing: -0.3px;
}

.business-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.business-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.business-card:hover {
    transform: translateY(-4px);
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.business-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #1a1a1a;
}

.business-info {
    padding: 1.25rem;
}

.business-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: -0.3px;
}

.business-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.business-stats {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.product-count {
    font-size: 0.813rem;
    color: var(--primary);
    font-weight: 500;
}

/* PRODUCTS VIEW - CATALOG */
#productsView {
    overflow-y: auto;
    min-height: 100vh;
    padding-bottom: 3rem;
}

.products-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
}

.back-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.share-button {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-button:hover {
    background: var(--primary);
    color: #000;
}

/* CATALOG CONTAINER */
.catalog-container {
    padding-top: 5rem;
    max-width: 1000px;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.catalog-info {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.catalog-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.catalog-logo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: #1a1a1a;
}

.catalog-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    letter-spacing: -0.3px;
}

.catalog-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.catalog-contact {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.813rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

/* PRODUCTS GRID - MAX 3 COLUMNS */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.product-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s ease;
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: rgba(74, 222, 128, 0.2);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

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

.product-card.sold-out {
    opacity: 0.5;
}

.product-card.sold-out:hover {
    transform: none;
    box-shadow: none;
}

.product-image-container {
    position: relative;
    aspect-ratio: 4/5;
    background: #111;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.8s ease;
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-available {
    background: var(--primary);
    color: #000;
}

.badge-sold {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    backdrop-filter: blur(10px);
}

/* Image carousel dots */
.image-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    z-index: 5;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--primary);
    width: 18px;
    border-radius: 3px;
}

.product-details {
    padding: 1rem;
}

.product-name {
    font-size: 0.938rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    line-height: 1.3;
    letter-spacing: -0.2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.product-desc {
    font-size: 0.813rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.apartalo-btn {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 0.75rem;
    border-radius: 10px;
    font-size: 0.813rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.apartalo-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 222, 128, 0.3);
}

.apartalo-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.apartalo-btn.reserved {
    background: #333;
    color: #666;
}

/* PRODUCT MODAL */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 200;
    display: none;
    overflow-y: auto;
    padding: 1rem;
}

.product-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    margin: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.modal-gallery {
    position: relative;
    aspect-ratio: 1;
    background: #111;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    overflow-x: auto;
}

.gallery-thumbnails::-webkit-scrollbar {
    display: none;
}

.gallery-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    opacity: 0.6;
    transition: all 0.2s;
}

.gallery-thumb:hover {
    opacity: 0.9;
}

.gallery-thumb.active {
    border-color: var(--primary);
    opacity: 1;
}

.modal-info {
    padding: 1.5rem;
}

.modal-product-name {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.modal-product-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    letter-spacing: -0.3px;
}

.modal-product-desc {
    font-size: 0.938rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.modal-stock {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 8px;
    font-size: 0.813rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.modal-apartalo-btn {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.938rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-apartalo-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(74, 222, 128, 0.35);
}

.modal-apartalo-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-text {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.empty-subtext {
    font-size: 0.875rem;
}

/* RESPONSIVE - MAX 3 COLUMNS */
@media (min-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .business-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .hero {
        padding: 5rem 2rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .catalog-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .catalog-contact {
        margin-top: 0;
    }

    .product-details {
        padding: 1.25rem;
    }

    .product-name {
        font-size: 1rem;
    }

    .product-price {
        font-size: 1.375rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 3rem 2rem;
    }

    .business-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .business-card:hover {
        transform: translateY(-8px);
    }

    .products-grid {
        gap: 1.5rem;
    }
}

/* ========================================
   LIVE MODAL - Producto en tiempo real
   ======================================== */

.live-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    display: none;
}

.live-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.live-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
}

.live-modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid #ef4444;
    box-shadow: 0 0 60px rgba(239, 68, 68, 0.3);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.live-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.live-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Contador Regresivo */
.live-countdown-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.938rem;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.countdown-icon {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.countdown-time {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* Últimos 10 segundos - urgente */
.live-countdown-badge.urgent {
    animation: urgentPulse 0.5s infinite;
}

@keyframes urgentPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

/* Animación de cierre */
.live-modal.closing .live-modal-content {
    animation: popOut 0.3s ease forwards;
}

@keyframes popOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.live-product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #111;
}

.live-product-info {
    padding: 1.5rem;
}

.live-product-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.live-product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.live-product-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.live-product-stock {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(74, 222, 128, 0.15);
    border-radius: 8px;
    font-size: 0.813rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.live-apartalo-btn {
    width: 100%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.live-apartalo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(239, 68, 68, 0.4);
}

.live-apartalo-btn:active {
    transform: translateY(0);
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* ========================================
   PRODUCTO PRÓXIMAMENTE (ACTIVO)
   ======================================== */

.product-card.coming-soon {
    position: relative;
    cursor: default;
}

.product-card.coming-soon .product-image {
    filter: grayscale(100%);
    opacity: 0.5;
}

.product-card.coming-soon .product-info {
    opacity: 0.6;
}

.product-card.coming-soon:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.05);
}

.coming-soon-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========================================
   PRODUCTO AGOTADO
   ======================================== */

.product-card.out-of-stock {
    position: relative;
    cursor: default;
}

.product-card.out-of-stock .product-image {
    filter: grayscale(50%);
    opacity: 0.6;
}

.product-card.out-of-stock:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.05);
}

.out-of-stock-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* ========================================
   BOTÓN DESHABILITADO
   ======================================== */

.btn-apartar.disabled {
    background: #374151 !important;
    color: #9ca3af !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-apartar.disabled:hover {
    transform: none;
    box-shadow: none;
    background: #374151 !important;
}

/* Stock bajo */
.product-stock.low {
    color: #f59e0b;
}