/* ===== VARIABLES Y RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores profesionales - Paleta neutra */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Grises sofisticados */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Sombras profesionales - Sutiles y sofisticadas */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);

    /* Sombras internas para profundidad */
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* Transiciones suaves */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== ESTILOS GLOBALES ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* ===== HEADER PROFESIONAL ===== */
.hero {
    margin-bottom: 48px;
    padding: 60px 0 40px;
    border-bottom: 1px solid var(--gray-200);
}

.hero-content {
    text-align: center;
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    width: 100%;
    position: relative;
}

/* Brand Logo Moderno */
.brand-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin: 0;
    display: flex;
    align-items: center;
    line-height: 1;
    transition: var(--transition);
}

.logo-text:hover {
    transform: scale(1.02);
}

/* "e" con gradiente vibrante y moderno */
.logo-e {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    font-size: 1em;
    margin-right: 2px;
    position: relative;
    transition: var(--transition);
}

/* Efecto hover en la "e" - más sutil y profesional */
.logo-text:hover .logo-e {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    filter: brightness(1.1);
}

/* "PriceFlo" principal - Negro sólido para mejor legibilidad */
.logo-main {
    color: var(--gray-900);
    font-weight: 900;
}

/* Tagline debajo del logo - Más limpio sin italic */
.logo-tagline {
    font-size: 0.95rem;
    color: var(--gray-600);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin: 0;
    text-transform: lowercase;
}

.reports-link {
    position: absolute;
    top: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.reports-link:hover {
    background: var(--gray-200);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    margin: 0;
}

.highlight {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--gray-600);
    margin: 12px 0 24px;
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Country Selector */
.country-selector-wrapper {
    position: relative;
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-800);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.country-selector:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.country-flag {
    font-size: 1.5rem;
    line-height: 1;
}

.country-name {
    font-size: 0.95rem;
}

.country-arrow {
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.country-selector:hover .country-arrow {
    opacity: 1;
}

.country-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.country-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.country-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--gray-700);
    transition: background-color 0.15s ease;
}

.country-dropdown-item:hover {
    background: var(--gray-50);
}

.country-dropdown-item.active {
    background: var(--gray-100);
    color: var(--accent);
    font-weight: 600;
}

.country-dropdown-item .country-flag {
    font-size: 1.5rem;
}

.country-dropdown-item:first-child {
    border-radius: 12px 12px 0 0;
}

.country-dropdown-item:last-child {
    border-radius: 0 0 12px 12px;
}

.hero-badges {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

.badge-live {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== SEARCH SECTION ===== */
.search-section {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 32px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.search-wrapper {
    display: flex;
    align-items: stretch;
    gap: 12px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-input {
    flex: 1;
    padding: 14px 16px 14px 48px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--white);
    transition: var(--transition);
    outline: none;
    color: var(--gray-900);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--gray-900);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--gray-800);
    box-shadow: var(--shadow-md);
}

.search-btn:active {
    transform: translateY(1px);
}

.search-btn svg {
    stroke-width: 2;
}

/* ===== STATS DASHBOARD ===== */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--white);
    padding: 28px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-icon svg {
    stroke-width: 2;
}

.stat-icon-blue {
    background: #eff6ff;
    color: var(--accent);
}

.stat-icon-purple {
    background: #faf5ff;
    color: #9333ea;
}

.stat-icon-green {
    background: #ecfdf5;
    color: var(--success);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
    letter-spacing: -0.025em;
}

.stat-content p {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== CATEGORIES ===== */
.categories-section {
    margin-bottom: 32px;
}

.section-title {
    color: var(--gray-900);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}

.categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    text-transform: capitalize;
    color: var(--gray-700);
    box-shadow: var(--shadow-xs);
}

.category-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
}

.category-btn.active {
    background: var(--gray-900);
    color: white;
    border-color: var(--gray-900);
    box-shadow: var(--shadow-md);
}

/* Dropdown de categorías */
.category-more-container {
    position: relative;
    display: inline-block;
}

.category-more-btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-more-btn svg {
    transition: transform 0.2s ease;
}

.category-more-btn:hover svg {
    transform: translateY(2px);
}

.category-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.category-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.category-dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--gray-700);
    transition: background-color 0.15s ease;
    text-transform: capitalize;
}

.category-dropdown-item:hover {
    background: var(--gray-50);
}

.category-dropdown-item.active {
    background: var(--gray-100);
    color: var(--gray-900);
    font-weight: 600;
}

.category-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.category-dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* ===== PRODUCTS SECTION ===== */
.products-section {
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.sort-select {
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    color: var(--gray-700);
    background: var(--white);
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.sort-select:hover {
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
}

.sort-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

/* ===== PRODUCT CARDS - DISEÑO PROFESIONAL ===== */
.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: var(--transition-slow);
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.product-header {
    padding: 24px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

.product-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-900);
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.category-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.025em;
}

.prices-list {
    padding: 20px;
    background: var(--gray-50);
}

.price-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.price-item:last-child {
    margin-bottom: 0;
}

.price-item:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}

.price-item.best-price {
    background: linear-gradient(to right, #ecfdf5 0%, #ffffff 100%);
    border-color: var(--success);
    border-width: 2px;
    position: relative;
}

.price-item.best-price::before {
    content: '🏆';
    position: absolute;
    top: -12px;
    right: 12px;
    font-size: 1.25rem;
}

.store-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9375rem;
}

.store-name small {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.best-price .price {
    color: var(--success);
}

.price-date {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 4px;
    grid-column: 1 / -1;
}

.btn-visit-store {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    grid-column: 1 / -1;
    justify-self: stretch;
    box-shadow: 0 4px 14px 0 rgba(102, 126, 234, 0.39);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-visit-store::before {
    content: '💰';
    font-size: 1.1em;
    animation: bounce 2s ease-in-out infinite;
}

.btn-visit-store::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-visit-store:hover::after {
    left: 100%;
}

.btn-visit-store:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px 0 rgba(102, 126, 234, 0.5);
}

.btn-visit-store:active {
    transform: translateY(0) scale(0.98);
}

.btn-visit-store svg {
    width: 16px;
    height: 16px;
    opacity: 1;
    transition: transform 0.3s;
}

.btn-visit-store:hover svg {
    transform: translateX(3px);
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.best-price .btn-visit-store {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.45);
    animation: pulse-glow 2s ease-in-out infinite;
}

.best-price .btn-visit-store:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.6);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.45);
    }
    50% {
        box-shadow: 0 4px 20px 0 rgba(16, 185, 129, 0.7);
    }
}

.no-prices {
    text-align: center;
    padding: 32px 20px;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.product-footer {
    padding: 16px 20px;
    background: var(--white);
    border-top: 1px solid var(--gray-100);
    text-align: center;
}

.btn-history {
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.btn-history:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
}

.btn-history:active {
    transform: translateY(1px);
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--gray-200);
}

.spinner-modern {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--gray-900);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.9375rem;
}

/* ===== ERROR & NO RESULTS ===== */
.error, .no-results {
    background: var(--white);
    padding: 48px 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.error h3, .no-results h3 {
    color: var(--gray-900);
    margin-bottom: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.error p, .no-results p {
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 8px;
}

.error code, .no-results code {
    background: var(--gray-100);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: var(--gray-800);
    font-size: 0.875rem;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: 80px;
    padding: 48px 0 24px;
    border-top: 1px solid var(--gray-200);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 32px;
}

.footer-section h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
    color: var(--gray-900);
    font-weight: 600;
}

.footer-section h4 {
    font-size: 0.9375rem;
    margin-bottom: 12px;
    color: var(--gray-700);
    font-weight: 600;
}

.footer-section p {
    color: var(--gray-600);
    line-height: 1.6;
    font-size: 0.875rem;
}

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

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.footer-date {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.8125rem;
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.affiliate-disclosure {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    color: var(--gray-700);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.affiliate-disclosure strong {
    color: var(--primary);
    font-weight: 600;
}

/* ===== BADGES DE URGENCIA/ESCASEZ ===== */
.urgency-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.urgency-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Badge: Precio más bajo */
.urgency-badge.lowest-price {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    border: 1px solid #86efac;
}

/* Badge: Precio subiendo */
.urgency-badge.price-rising {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Badge: Gran descuento */
.urgency-badge.big-discount {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Badge: Precio estable */
.urgency-badge.stable-price {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Badge: Oferta reciente */
.urgency-badge.recent-drop {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #3730a3;
    border: 1px solid #a5b4fc;
}

/* Iconos de badges */
.urgency-badge::before {
    font-size: 0.875rem;
}

.urgency-badge.lowest-price::before {
    content: '🔥';
}

.urgency-badge.price-rising::before {
    content: '📈';
}

.urgency-badge.big-discount::before {
    content: '💰';
}

.urgency-badge.stable-price::before {
    content: '📊';
}

.urgency-badge.recent-drop::before {
    content: '⬇️';
}

/* Animación sutil para badges importantes */
.urgency-badge.lowest-price,
.urgency-badge.big-discount {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Mobile: badges más pequeños */
@media (max-width: 480px) {
    .urgency-badge {
        font-size: 0.688rem;
        padding: 3px 8px;
    }

    .urgency-badge::before {
        font-size: 0.75rem;
    }
}

/* ===== MEJORAS TÁCTILES GENERALES ===== */
/* Smooth scrolling en móvil */
html {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Mejor scroll en móvil */
.categories,
.products-grid,
.autocomplete-dropdown {
    -webkit-overflow-scrolling: touch;
}

/* Botones más accesibles al tacto */
button,
a.btn-visit-store,
a.reports-link,
.category-btn {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

/* Hover solo en desktop (no en táctil) */
@media (hover: hover) and (pointer: fine) {
    button:hover,
    .btn-visit-store:hover,
    .category-btn:hover {
        transform: translateY(-1px);
    }
}

/* En móvil/táctil, usar active en vez de hover */
@media (hover: none) and (pointer: coarse) {
    button:active,
    .btn-visit-store:active,
    .category-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Evitar selección de texto en elementos UI */
.category-btn,
.btn-visit-store,
.btn-history,
.search-btn,
.stat-card {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Safe area para iPhone X+ */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(32px, env(safe-area-inset-left));
        padding-right: max(32px, env(safe-area-inset-right));
    }

    @media (max-width: 768px) {
        .container {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }
    }

    @media (max-width: 480px) {
        .container {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .hero {
        padding: 40px 0 32px;
    }

    .hero-title {
        font-size: 2rem;
    }

    /* Logo responsive tablet */
    .logo-text {
        font-size: 2.75rem;
    }

    .logo-tagline {
        font-size: 0.875rem;
    }

    .search-wrapper {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
        font-size: 16px; /* Previene zoom en iOS */
    }

    .search-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px; /* Touch target */
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .stat-content h3 {
        font-size: 1.75rem;
    }

    .price-item {
        grid-template-columns: 1fr;
    }

    .price {
        margin-top: 8px;
    }

    /* Stats en 2 columnas en tablet */
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Categorías con mejor scroll */
    .categories {
        gap: 12px;
        padding-bottom: 4px;
    }

    .category-btn {
        padding: 10px 18px;
        min-height: 44px; /* Touch target */
    }

    /* Reportes link más visible */
    .reports-link {
        padding: 8px 16px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }

    /* Reducir padding en contenedor */
    .container {
        padding: 16px 12px;
    }

    /* Hero más compacto */
    .hero {
        padding: 24px 0;
    }

    .hero-subtitle {
        font-size: 0.875rem;
    }

    .hero-badges {
        flex-direction: column;
        gap: 8px;
    }

    /* Logo responsive móvil */
    .logo-text {
        font-size: 2.25rem;
    }

    .logo-tagline {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }

    .logo-wrapper {
        margin-bottom: 16px;
    }

    /* Búsqueda más compacta */
    .search-section {
        padding: 16px;
        margin-bottom: 20px;
    }

    .search-input {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 12px 12px 12px 44px;
    }

    .search-btn {
        padding: 12px 16px;
        font-size: 0.875rem;
    }

    /* Stats en una columna */
    .stats-dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Categorías scroll horizontal */
    .categories {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        gap: 8px;
    }

    .categories::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }

    .category-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 0.875rem;
    }

    /* Product cards más compactas */
    .product-card {
        padding: 16px;
    }

    .product-header h3 {
        font-size: 1rem;
    }

    /* Precios apilados */
    .price-item {
        padding: 12px;
    }

    .store-name {
        font-size: 0.875rem;
    }

    .price {
        font-size: 1.25rem;
    }

    .price-date {
        font-size: 0.75rem;
    }

    /* Botones más grandes para touch */
    .btn-visit-store {
        padding: 12px 20px;
        font-size: 0.875rem;
        min-height: 44px; /* iOS touch target */
    }

    .btn-history {
        padding: 10px 16px;
        font-size: 0.875rem;
        min-height: 44px;
    }

    /* Footer más compacto */
    .footer {
        padding: 32px 0 24px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-section h3 {
        font-size: 1.125rem;
    }

    .affiliate-disclosure {
        font-size: 0.75rem;
        padding: 12px;
    }

    /* Section headers */
    .section-title {
        font-size: 1.25rem;
    }

    .sort-select {
        font-size: 0.875rem;
        padding: 8px 32px 8px 12px;
    }
}

/* ===== MEJORAS DE ACCESIBILIDAD ===== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== UTILIDADES ===== */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

/* ===== GOOGLE ADSENSE - CONTENEDORES DE ANUNCIOS ===== */

/* Contenedor genérico de anuncios */
.ad-container {
    margin: 20px auto;
    padding: 10px;
    max-width: 100%;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
}

/* Header ad - Banner horizontal superior */
.ad-header {
    max-width: 1200px;
    min-height: 90px;
    margin: 20px auto;
}

/* Sidebar ad - Cuadrado lateral */
.ad-sidebar {
    position: sticky;
    top: 20px;
    width: 300px;
    min-height: 250px;
    margin: 0;
}

/* Footer ad - Banner horizontal inferior */
.ad-footer {
    max-width: 1200px;
    min-height: 90px;
    margin: 30px auto 20px;
}

/* Layout para productos con sidebar de ads */
.products-main-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    align-items: start;
}

.sidebar-ads {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Responsivo - Ocultar sidebar en móvil */
@media (max-width: 1024px) {
    .products-main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-ads {
        display: none;
    }
}

/* Ad entre resultados de búsqueda */
.ad-result {
    grid-column: 1 / -1;
    min-height: 100px;
    margin: 10px 0;
}

/* Animación sutil cuando carga el ad */
.ad-container.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsivo para ads header y footer */
@media (max-width: 768px) {
    .ad-header,
    .ad-footer {
        min-height: 50px;
        margin: 15px auto;
    }
}

/* ===== SKELETON LOADING ===== */
.skeleton-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-header {
    height: 24px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 16px;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-price {
    height: 80px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    margin: 16px 0;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-button {
    height: 40px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Grid de skeletons */
.skeletons-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .skeletons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .skeletons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1440px) {
    .skeletons-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--white);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
    opacity: 1;
    border-left: 4px solid var(--gray-400);
}

.toast.toast-enter {
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Toast types */
.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-success .toast-icon {
    color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-error .toast-icon {
    color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-warning .toast-icon {
    color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--accent);
}

.toast.toast-info .toast-icon {
    color: var(--accent);
}

/* Toast icon */
.toast-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Toast content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
    line-height: 1.4;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

/* Toast close button */
.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

/* Progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    border-radius: 0 0 0 12px;
    opacity: 0.3;
    animation: toastProgress var(--duration, 5s) linear forwards;
}

/* Animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(120%) scale(0.9);
        opacity: 0;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ===== AUTOCOMPLETE SEARCH ===== */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
    animation: autocompleteSlideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--gray-50);
}

.autocomplete-item.selected {
    background: var(--accent);
    color: var(--white);
}

.autocomplete-icon {
    color: var(--gray-400);
    font-size: 16px;
    flex-shrink: 0;
}

.autocomplete-item.selected .autocomplete-icon {
    color: var(--white);
}

.autocomplete-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.autocomplete-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-900);
}

.autocomplete-item.selected .autocomplete-title {
    color: var(--white);
}

.autocomplete-subtitle {
    font-size: 12px;
    color: var(--gray-500);
}

.autocomplete-item.selected .autocomplete-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.autocomplete-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

.autocomplete-loading {
    padding: 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.autocomplete-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes autocompleteSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Scrollbar personalizado para autocomplete */
.autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===================================
   PAGINATION CONTROLS
   =================================== */

.pagination-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 32px 0;
    padding: 20px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination-info {
    text-align: center;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-pages {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-page {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-page:hover {
    background: var(--gray-50);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination-page.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--gray-400);
    font-weight: 500;
    user-select: none;
}

/* Responsive para pagination */
@media (max-width: 768px) {
    .pagination-container {
        padding: 16px;
        margin: 24px 0;
    }

    .pagination-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    .pagination-page {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .pagination-info {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .pagination-btn span {
        display: none; /* Ocultar texto en móviles */
    }

    .pagination-btn {
        padding: 8px;
    }
}
