/* Root Variables and Global Settings */
:root {
    --bg-base: #030409;
    --bg-glass: rgba(15, 17, 26, 0.6);
    --bg-glass-hover: rgba(25, 28, 41, 0.8);
    
    --text-primary: #f8fafc;
    --text-secondary: #b0bec5;
    
    --accent-primary: #3b82f6; 
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-purple: #8b5cf6; 
    --accent-gold: #fbbf24; 
    
    --border-glass: 1px solid rgba(255, 255, 255, 0.08);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --font-main: 'Outfit', sans-serif;
    --font-display: 'Plus Jakarta Sans', sans-serif;
    --radius-std: 1rem;

    /* Mathematical Spacing Scale (Fibonacci-ish) */
    --space-unit: 1rem;
    --space-xs: calc(var(--space-unit) * 0.5);
    --space-md: var(--space-unit);
    --space-lg: calc(var(--space-unit) * 1.618);
    --space-xl: calc(var(--space-unit) * 2.618);

    /* Fluid Typography: Locks text size between 320px and 1200px viewports */
    --font-h1: clamp(2rem, 1.5rem + 2.5vw, 4rem); 
    
    /* Constraint-based Layout */
    --content-max-width: min(90vw, 1300px); 
}

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

/* Screen-reader only utility (SEO: exposes nav links to crawlers without visual disruption) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sr-only:focus-within {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    margin: 0;
    overflow: visible;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    padding-bottom: 120px;
    overflow-x: hidden;
}

.layout-container {
    width: 100%;
    max-width: var(--content-max-width);
    margin-inline: auto;
    padding: var(--space-md);
    position: relative;
    z-index: auto;
}

header {
    text-align: center;
    padding-bottom: var(--space-xl);
    margin-bottom: var(--space-xl);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%; transform: translateX(-50%);
    width: 150px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-purple), transparent);
}

h1 {
    font-family: var(--font-display);
    font-size: var(--font-h1);
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

header p {
    max-width: 32rem;
    min-height: 1.5rem;
    margin-inline: auto;
    text-wrap: balance;
}

.currency-btn, .currency-btn:hover:not(.active), .currency-btn.active {
    display: none;
}

/* Product Grid System */
.section-title {
    color: white;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    min-height: 2rem;
    margin-top: 3rem; margin-bottom: 1.5rem;
    display: flex; align-items: center; gap: 1rem;
}
.section-title::after {
    content: ''; flex-grow: 1; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
}

.grid-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.combo-builder {
    min-height: 720px;
}

.combo-controls {
    min-height: 590px;
}

.result-bar {
    min-height: 99px;
}

#base-selector:empty {
    min-height: 56px;
}

#size-options:empty {
    min-height: 180px;
}

#platform-options:empty {
    min-height: 230px;
}

/* Reserva espacio antes del render JS para evitar saltos bruscos en home. */
.grid-matrix:empty {
    min-height: 240px;
}

#premium-grid:empty {
    min-height: 560px;
}

.card-product {
    display: flex;
    flex-direction: row;
    gap: 1.2rem;
    align-items: flex-start;
    background: var(--bg-glass);
    @supports (backdrop-filter: blur(16px)) {
        backdrop-filter: blur(16px);
    }
    @supports not (backdrop-filter: blur(16px)) {
        background: rgba(15, 17, 26, 0.95);
    }
    border: var(--border-glass);
    border-radius: var(--radius-std);
    padding: var(--space-md);
    position: relative;
    will-change: transform, box-shadow;
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    min-height: calc(100px + 2rem);
}

.product-image {
    width: clamp(120px, 30%, 180px);
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: calc(var(--radius-std) * 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1), 
        rgba(139, 92, 246, 0.1));
    flex-shrink: 0;
    image-rendering: crisp-edges;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
}

.card-header {
    flex-grow: 0;
}

.card-footer {
    flex-grow: 0;
    margin-top: auto;
    padding-top: var(--space-xs);
}

.product-title { 
    font-family: var(--font-display); 
    font-weight: 700; 
    font-size: clamp(1.1rem, 2.5vw, 1.25rem); 
    line-height: 1.2; 
    color: white; 
    margin-bottom: 0.25rem;
}
.product-subtitle { 
    font-size: clamp(0.75rem, 2vw, 0.85rem); 
    color: var(--text-secondary); 
    margin-bottom: 0.5rem;
}
.product-specs {
    font-size: 0.7rem;
    color: #93c5fd;
    margin-bottom: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    width: fit-content;
    font-weight: 600;
}

.product-price {
    font-family: var(--font-display);
    color: var(--accent-success);
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 1.6rem);
    margin-bottom: 0.5rem;
    line-height: 1;
}
.featured-card .product-price { color: var(--accent-gold); }

.badge {
    font-size: 0.65rem; padding: 0.2em 0.5em; border-radius: 4px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); text-transform: uppercase; font-weight: 600;
    margin-left: 0.5em; vertical-align: middle;
}
.badge-iptv { background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.3); color: #c4b5fd; }

.product-note {
    font-size: 0.75rem; color: #cbd5e1; 
    margin-bottom: 0.75rem;
    display: flex; gap: 0.4rem;
    background: rgba(0,0,0,0.2); padding: 0.5rem;
    border-radius: 6px; border-left: 2px solid var(--accent-warning);
}
.product-note.promo { border-left-color: var(--accent-success); }

.section-title-iptv {
    color: var(--accent-purple);
}

@media (max-width: 768px) {
    .grid-matrix {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .card-product {
        padding: 0.6rem;
        min-height: auto;
        gap: 0.6rem;
        flex-direction: column;
        text-align: center;
    }

    .product-image {
        width: 100%;
        aspect-ratio: 3 / 2;
        max-width: none;
    }

    .card-content {
        min-height: auto;
    }

    .product-title {
        font-size: 0.85rem;
        line-height: 1.1;
        margin-bottom: 0.3rem;
    }

    .product-subtitle {
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
    }

    .product-price {
        font-size: 1.15rem;
        margin-bottom: 0.3rem;
    }

    .product-note {
        font-size: 0.65rem;
        padding: 0.3rem;
        margin-bottom: 0.5rem;
    }

    .badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }
}

@media (max-width: 480px) {
    .grid-matrix {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .card-product {
        flex-direction: column;
        text-align: center;
        padding: 0.5rem;
        min-height: auto;
    }

    .product-image {
        width: 100%;
        margin: 0 0 0.5rem 0;
        aspect-ratio: 3 / 2;
    }

    .card-content {
        min-height: auto;
    }

    .product-title {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
    
    .product-subtitle {
        font-size: 0.6rem;
        margin-bottom: 0.2rem;
    }

    .product-price {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }
    
    .product-note {
        font-size: 0.6rem;
        padding: 0.25rem;
    }
}

app-header,
app-footer,
app-testimonials {
    display: block;
    width: 100%;
}

app-header {
    min-height: 88px;
}

app-testimonials {
    min-height: 420px;
    content-visibility: auto;
    contain-intrinsic-size: 860px;
}

app-footer {
    min-height: 260px;
    content-visibility: auto;
    contain-intrinsic-size: 340px;
}

@media (max-width: 920px) {
    .grid-matrix:empty {
        min-height: 320px;
    }

    #premium-grid:empty {
        min-height: 980px;
    }

    .combo-builder {
        min-height: 980px;
    }

    .combo-controls {
        min-height: 820px;
    }

    #platform-options:empty {
        min-height: 340px;
    }

    app-testimonials {
        min-height: 620px;
        contain-intrinsic-size: 1420px;
    }

    app-footer {
        min-height: 320px;
        contain-intrinsic-size: 420px;
    }
}
