/* css/style.css */

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

html,
body {
    height: 100%;
}

body.site {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #0f172a;
    background: #f1f5f9;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

/* Layout */
.site {
    display: flex;
    flex-direction: column;
}

.main {
    flex: 1;
    padding: 1.5rem 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Topbar */
.topbar {
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    color: #e5e7eb;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.5);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    font-size: 1.8rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mode-btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.4);
    color: #e5e7eb;
    padding: 0.4rem 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
}

.mode-btn i {
    font-size: 0.9rem;
}

.mode-btn-active {
    background: #fbbf24;
    color: #0f172a;
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
}

.mode-btn:hover {
    transform: translateY(-1px);
}

.theme-toggle {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 0.35rem 0.7rem;
    background: rgba(15, 23, 42, 0.4);
    color: #e5e7eb;
    cursor: pointer;
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.hero-text h1 {
    font-size: clamp(1.8rem, 3vw, 2.3rem);
    margin-bottom: 0.75rem;
}

.highlight {
    color: #2563eb;
}

.hero-text p {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 1rem;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-group label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    display: block;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 999px;
    padding: 0.2rem 0.4rem;
    border: 1px solid #1e293b;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
}

.search-icon {
    padding-left: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.85;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-size: 0.95rem;
}

.btn-primary {
    border-radius: 999px;
    background: #22c55e;
    color: #0f172a;
    border: none;
    padding: 0.45rem 1.0rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.btn-secondary {
    border-radius: 999px;
    background: #e2e8f0;
    color: #0f172a;
    border: none;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-secondary i {
    font-size: 0.9rem;
}

/* Chips / filtros */
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filters-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-right: 0.25rem;
}

.fuel-filters,
.ev-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.chip {
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    background: #e2e8f0;
    padding: 0.25rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: #1f2933;
}

.chip-active {
    background: #2563eb;
    color: #e5e7eb;
    border-color: #2563eb;
}

.chip-small {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

/* Location + sort row */
.location-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.82rem;
}

.range-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.range-group input[type="range"] {
    accent-color: #2563eb;
}

.sort-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Map */
.hero-map-container {
    position: relative;
}

.map {
    width: 100%;
    height: 320px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.3);
}

/* Results */
.results-section {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.results-header h2 {
    font-size: 1.2rem;
}

.results-count {
    font-size: 0.85rem;
    color: #64748b;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Cards */
.card {
    position: relative;
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 0.9rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.card-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1.5fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.card-logo {
    width: 48px;
    height: 48px;
    border-radius: 0.9rem;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 0 1px #dbeafe;
}

.card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.3rem;
}

.card-logo-fallback {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1d4ed8;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.card-location {
    font-size: 0.8rem;
    color: #64748b;
}

.card-address {
    font-size: 0.8rem;
    color: #94a3b8;
}

.card-schedule {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-schedule i {
    font-size: 0.8rem;
}

.card-distance {
    font-size: 0.8rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-distance i {
    color: #ef4444;
}

.card-side {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-end;
}

.price {
    text-align: right;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

.price-main {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.trend {
    font-size: 0.75rem;
    padding: 0.2rem 0.35rem;
    border-radius: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trend-up {
    background: #fee2e2;
    color: #dc2626;
}

.trend-down {
    background: #dcfce7;
    color: #16a34a;
}

.trend-same {
    background: #f1f5f9;
    color: #64748b;
}

.price-note {
    font-size: 0.7rem;
    color: #6b7280;
    display: block;
    margin-top: 0.15rem;
}

.price-update {
    font-size: 0.7rem;
    color: #94a3b8;
    display: block;
    margin-top: 0.25rem;
    font-style: italic;
}

.price-no-data span {
    font-size: 0.8rem;
    color: #6b7280;
}

.trend {
    margin-left: 0.25rem;
    font-size: 0.75rem;
    vertical-align: middle;
}

.trend-up {
    color: #b91c1c;
}

.trend-down {
    color: #16a34a;
}

.trend-same {
    color: #6b7280;
}

.ev-info {
    text-align: right;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ev-power {
    font-weight: 700;
    color: #0f172a;
}

.ev-level {
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: #ecfeff;
    color: #0f766e;
    font-size: 0.7rem;
}

.ev-conn {
    color: #6b7280;
}

.btn-go {
    margin-top: 0.1rem;
    border-radius: 999px;
    background: #2563eb;
    color: #f9fafb;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-go i {
    font-size: 0.8rem;
}

/* Rank & badges */
.card-rank {
    position: absolute;
    top: -0.45rem;
    right: -0.45rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: #fbbf24;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.3);
}

.card-badge {
    position: absolute;
    top: 0.35rem;
    left: 0.5rem;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.card-badge-restricted {
    background: #fee2e2;
    color: #b91c1c;
}

/* Estado */
.loader,
.empty,
.error {
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.loader {
    color: #1f2937;
}

.empty {
    color: #6b7280;
}

.error {
    color: #b91c1c;
}

/* Footer */
.footer {
    padding: 1rem;
    background: #0f172a;
    color: #cbd5f5;
    margin-top: 1.5rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-links a {
    color: #e5e7eb;
    opacity: 0.75;
    font-size: 0.8rem;
}

/* Modo oscuro */
body.theme-dark {
    background: #020617;
    color: #e5e7eb;
}

body.theme-dark .main {
    background: radial-gradient(circle at top, #111827 0, #020617 60%);
}

body.theme-dark .card {
    background: #020617;
    border-color: #1f2937;
    box-shadow: 0 0 0 1px #111827;
}

body.theme-dark .card-title {
    color: #e5e7eb;
}

body.theme-dark .card-address,
body.theme-dark .card-location {
    color: #9ca3af;
}

body.theme-dark .btn-go {
    background: #22c55e;
    color: #022c22;
}

body.theme-dark .results-count {
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-map-container {
        order: -1;
    }

    .map {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-main {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .card-side {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.3rem;
    }

    .hero {
        margin-top: 1rem;
    }
}

/* Trends Widget */
.trends-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
    width: 100%;
}

.trends-widget {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.trends-header h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trends-grid {
    display: grid;
    /* Force 4 columns on large screens, auto-wrap on small */
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .trends-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .trends-grid {
        grid-template-columns: 1fr;
    }
}

.trend-card {
    padding: 1rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.trend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.trend-title {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.trend-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.chart-wrapper {
    position: relative;
    height: 60px;
    width: 100%;
}

.chart-wrapper.small-chart {
    height: 40px;
}

.loader {
    color: #1f2937;
}

.empty {
    color: #6b7280;
}

.error {
    color: #b91c1c;
}

/* Footer */
.footer {
    padding: 1rem;
    background: #0f172a;
    color: #cbd5f5;
    margin-top: 1.5rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-links a {
    color: #e5e7eb;
    opacity: 0.75;
    font-size: 0.8rem;
}

/* Modo oscuro */
body.theme-dark {
    background: #020617;
    color: #e5e7eb;
}

body.theme-dark .main {
    background: radial-gradient(circle at top, #111827 0, #020617 60%);
}

body.theme-dark .card {
    background: #020617;
    border-color: #1f2937;
    box-shadow: 0 0 0 1px #111827;
}

body.theme-dark .card-title {
    color: #e5e7eb;
}

body.theme-dark .card-address,
body.theme-dark .card-location {
    color: #9ca3af;
}

body.theme-dark .btn-go {
    background: #22c55e;
    color: #022c22;
}

body.theme-dark .results-count {
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-map-container {
        order: -1;
    }

    .map {
        height: 260px;
    }
}

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-main {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .card-side {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.3rem;
    }

    .hero {
        margin-top: 1rem;
    }
}

/* Trends Widget */
.trends-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
    width: 100%;
}

.trends-widget {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.trends-header h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trends-grid {
    display: grid;
    /* Force 4 columns on large screens, auto-wrap on small */
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .trends-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .trends-grid {
        grid-template-columns: 1fr;
    }
}

.trend-card {
    padding: 1rem;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.trend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.trend-title {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.trend-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.chart-wrapper {
    position: relative;
    height: 60px;
    width: 100%;
}

.chart-wrapper.small-chart {
    height: 40px;
}

.small-card {
    opacity: 1;
}

/* Ranking Table Modern */
.ranking-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.ranking-header-mod {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .ranking-header-mod {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.ranking-header-mod h3 {
    font-size: 1.3rem;
    color: #1e293b;
    margin: 0;
}

/* Tabs */
.rank-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: 999px;
    gap: 0.25rem;
    overflow-x: auto;
    /* Allow scroll on small mobile */
}

.rank-tab {
    border: none;
    background: transparent;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.rank-tab:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.5);
}

.rank-tab.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Table Container */
.ranking-table-container {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    /* rounded corners fix */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.ranking-table th {
    background: #f8fafc;
    padding: 1rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ranking-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.ranking-table tr:last-child td {
    border-bottom: none;
}

.ranking-table tr:hover {
    background-color: #f8fafc;
}

/* Specific Columns */
.rank-pos {
    font-weight: 700;
    color: #94a3b8;
    text-align: center;
}

.rank-pos.rank-top {
    font-size: 1.1rem;
}

.rank-prov {
    font-weight: 600;
    color: #0f172a;
}

.price-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.price-good {
    color: #16a34a;
    font-weight: 700;
}

.price-cell-sec {
    color: #64748b;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.rank-footer {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.8rem;
    text-align: center;
}

.empty-rank {
    padding: 2rem;
    text-align: center;
    color: #64748b;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

/* Dark Mode Ranking */
body.theme-dark .ranking-header-mod h3 {
    color: #e5e7eb;
}

body.theme-dark .rank-tabs {
    background: #1e293b;
}

body.theme-dark .rank-tab {
    color: #94a3b8;
}

body.theme-dark .rank-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

body.theme-dark .rank-tab.active {
    background: #334155;
    color: #fbbf24;
}

body.theme-dark .ranking-table-container {
    background: #0f172a;
    border-color: #1e293b;
}

body.theme-dark .ranking-table th {
    background: #1e293b;
    color: #94a3b8;
    border-bottom-color: #334155;
}

body.theme-dark .ranking-table td {
    border-bottom-color: #1e293b;
    color: #cbd5e1;
}

body.theme-dark .ranking-table tr:hover {
    background-color: #1e293b;
}

body.theme-dark .rank-prov {
    color: #e5e7eb;
}

/* National Stats */
.stats-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.stats-header h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #334155;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stats-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    align-items: flex-start;
}

.stats-icon {
    font-size: 1.5rem;
    background: #f1f5f9;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.stats-icon-fuel {
    background: #dbeafe;
}

.stats-icon-chart {
    background: #f3e8ff;
}

.stats-icon-cheap {
    background: #dcfce7;
}

.stats-icon-expensive {
    background: #fee2e2;
}

.stats-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stats-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stats-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.stats-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
}

.stats-pill {
    font-size: 0.7rem;
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    color: #475569;
}

.stats-diff {
    font-size: 1.1rem;
    font-weight: 700;
}

.diff-up {
    color: #dc2626;
}

/* Precio sube es malo */
.diff-down {
    color: #16a34a;
}

/* Precio baja es bueno */

.stats-sub {
    font-size: 0.75rem;
    color: #94a3b8;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    border-bottom: 1px dotted #e2e8f0;
    padding-bottom: 0.15rem;
}

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

.stats-prov {
    color: #334155;
    font-weight: 500;
}

.stats-price-mini {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

/* Dark theme stats */
body.theme-dark .stats-card {
    background: #0f172a;
    border-color: #1f2937;
}

body.theme-dark .stats-icon {
    background: #1e293b;
}

body.theme-dark .stats-info h3 {
    color: #e5e7eb;
}

body.theme-dark .stats-val {
    color: #e5e7eb;
}

body.theme-dark .stats-prov {
    color: #cbd5e1;
}

body.theme-dark .stats-header h3 {
    color: #e5e7eb;
}

/* Autocomplete Dropdown */
.search-box {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    margin-top: 0.5rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

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

.autocomplete-item:hover,
.autocomplete-item-selected {
    background-color: #f8fafc;
}

.autocomplete-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.autocomplete-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.autocomplete-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

.autocomplete-meta {
    font-size: 0.75rem;
    color: #64748b;
}

/* Dark mode autocomplete */
body.theme-dark .autocomplete-dropdown {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .autocomplete-item {
    border-bottom-color: #334155;
}

body.theme-dark .autocomplete-item:hover,
body.theme-dark .autocomplete-item-selected {
    background-color: #334155;
}

body.theme-dark .autocomplete-name {
    color: #e5e7eb;
}

body.theme-dark .autocomplete-meta {
    color: #94a3b8;
}

/* Nearby Cheapest Section */
.nearby-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.nearby-header {
    text-align: center;
    margin-bottom: 2rem;
}

.nearby-header h3 {
    font-size: 1.5rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.nearby-subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

.nearby-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .nearby-grid {
        grid-template-columns: 1fr;
    }
}

.nearby-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    background: #f8fafc;
    border-radius: 1rem;
    border: 2px dashed #e2e8f0;
}

.nearby-placeholder i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.nearby-placeholder p {
    color: #64748b;
    font-size: 0.95rem;
}

.nearby-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.nearby-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
}

.nearby-card-rank {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.3);
}

.nearby-card-rank.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.nearby-card-rank.rank-2 {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    color: #1e293b;
}

.nearby-card-rank.rank-3 {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    color: #7c2d12;
}

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

.nearby-card-logo {
    width: 60px;
    height: 60px;
    border-radius: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nearby-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nearby-card-logo-fallback {
    font-size: 1.25rem;
    font-weight: 800;
    color: #64748b;
}

.nearby-card-info {
    flex: 1;
}

.nearby-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.nearby-card-location {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nearby-card-price {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
}

.nearby-card-price-label {
    font-size: 0.75rem;
    color: #15803d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.nearby-card-price-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #15803d;
    font-variant-numeric: tabular-nums;
}

.nearby-card-distance {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.nearby-card-btn {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.nearby-card-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}


/* Dark mode nearby */
body.theme-dark .nearby-header h3 {

    color: #e5e7eb;
}

body.theme-dark .nearby-subtitle {
    color: #94a3b8;
}

body.theme-dark .nearby-placeholder {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .nearby-placeholder i {
    color: #475569;
}

body.theme-dark .nearby-card {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .nearby-card-name {
    color: #e5e7eb;
}

body.theme-dark .nearby-card-logo {
    background: #0f172a;
}

body.theme-dark .nearby-card-price {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    border-color: #10b981;
}

body.theme-dark .nearby-card-price-label {
    color: #d1fae5;
}

body.theme-dark .nearby-card-price-value {
    color: #d1fae5;
}

/* Dark mode for main result cards */
body.theme-dark .card {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .card-title {
    color: #e5e7eb;
}

body.theme-dark .card-location,
body.theme-dark .card-address,
body.theme-dark .card-schedule {
    color: #94a3b8;
}

body.theme-dark .card-distance {
    color: #e5e7eb;
}

body.theme-dark .price-main {
    color: #d1fae5;
}

body.theme-dark .price-note {
    color: #94a3b8;
}

body.theme-dark .price-update {
    color: #64748b;
}

body.theme-dark .trend-up {
    background: #7f1d1d;
    color: #fca5a5;
}

body.theme-dark .trend-down {
    background: #14532d;
    color: #86efac;
}

body.theme-dark .trend-same {
    background: #334155;
    color: #94a3b8;
}

body.theme-dark .card-logo {
    background: #0f172a;
}

/* Fuel News Section */
.fuel-news-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.fuel-news-header {
    text-align: center;
    margin-bottom: 2rem;
}

.fuel-news-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.fuel-news-header h2 {
    font-size: 1.75rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.fuel-news-subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

.fuel-news-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .fuel-news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .fuel-news-grid {
        grid-template-columns: 1fr;
    }
}

.fuel-news-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fuel-news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
}

.fuel-news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fuel-news-card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #475569;
    margin: 0;
}

.fuel-news-trend {
    font-size: 1.5rem;
}

.fuel-news-price {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.fuel-news-unit {
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
}

.fuel-news-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    display: inline-block;
}

.fuel-news-change-up {
    background: #fee2e2;
    color: #991b1b;
}

.fuel-news-change-down {
    background: #dcfce7;
    color: #166534;
}

.fuel-news-change-neutral {
    background: #f1f5f9;
    color: #475569;
}

.fuel-news-footer {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
}

.fuel-news-footer p {
    font-size: 1rem;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

.fuel-news-footer strong {
    color: #0f172a;
}

/* Dark mode fuel news */
body.theme-dark .fuel-news-header h2 {
    color: #e5e7eb;
}

body.theme-dark .fuel-news-subtitle {
    color: #94a3b8;
}

body.theme-dark .fuel-news-card {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .fuel-news-card-header h3 {
    color: #94a3b8;
}

body.theme-dark .fuel-news-price {
    color: #e5e7eb;
}

body.theme-dark .fuel-news-footer {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

body.theme-dark .fuel-news-footer p {
    color: #94a3b8;
}

body.theme-dark .fuel-news-footer strong {
    color: #e5e7eb;
}

/* Pagination */
/* Pagination */
.pagination-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.pagination-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
    /* Minimal container */
}

/* Items per page selector */
.pagination-ipp {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    padding-right: 1.5rem;
    border-right: 1px solid #e2e8f0;
}

.ipp-select {
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    outline: none;
    padding: 0;
}

.ipp-select:focus {
    color: #2563eb;
}

/* Page buttons */
.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.page-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.page-btn:hover {
    color: #2563eb;
    background: transparent;
}

.page-btn.active {
    color: #2563eb;
    font-weight: 800;
    background: transparent;
    border: none;
    box-shadow: none;
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.page-dots {
    color: #94a3b8;
    font-weight: 400;
    padding: 0 0.25rem;
}

/* Dark mode for pagination */
body.theme-dark .pagination-wrapper {
    background: transparent;
    border: none;
    box-shadow: none;
}

body.theme-dark .pagination-ipp {
    color: #94a3b8;
    border-color: #334155;
}

body.theme-dark .ipp-select {
    background: transparent;
    color: #e5e7eb;
}

body.theme-dark .ipp-select:focus {
    color: #86efac;
}

body.theme-dark .page-btn {
    color: #94a3b8;
}

body.theme-dark .page-btn:hover {
    background: transparent;
    color: #86efac;
}

body.theme-dark .page-btn.active {
    background: transparent;
    color: #86efac;
    border: none;
}
/* Botón 'Ver ficha' en listados */
.btn-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
    margin-right: 8px;
}
.btn-details:hover {
    background-color: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Ajuste para btn-go (solo icono) */
.btn-go {
    padding: 10px 12px;
}


/* Multi-price display in cards */
.prices-compact-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 5px;
    font-family: 'Inter', system-ui, sans-serif;
}
.pcl-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #475569;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 2px;
}
.pcl-row:last-child {
    border-bottom: none;
}
.pcl-name {
    font-weight: 600;
    color: #64748b;
    font-size: 0.8rem;
}
.pcl-val {
    font-weight: 700;
    color: #0f172a;
}
.price-container-multi {
    text-align: right;
    min-width: 90px;
}


/* Map Container Fix */
.hero-map-container { height: 500px !important; min-height: 500px; }
.map { height: 100% !important; min-height: 100%; }

/* --- CARD V2 REDESIGN --- */
.card-v2 { display: flex; flex-direction: row; background: #fff; border-radius: 16px; padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); gap: 1.5rem; align-items: center; border: 1px solid #f1f5f9; }
.card-v2:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); transform: translateY(-2px); transition: all 0.2s; }

/* Left Column */
.card-v2-left { flex: 2; display: flex; gap: 1rem; align-items: flex-start; }
.cv2-logo { width: 60px; height: 60px; flex-shrink: 0; border-radius: 12px; overflow: hidden; background: #f8fafc; display: flex; align-items: center; justify-content: center; border: 1px solid #e2e8f0; }
.cv2-logo img { width: 100%; height: 100%; object-fit: contain; }
.cv2-info { display: flex; flex-direction: column; gap: 0.25rem; }
.cv2-header { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.cv2-title { font-size: 1.1rem; font-weight: 700; color: #0f172a; margin: 0; }
.cv2-locality { font-size: 0.9rem; color: #64748b; font-weight: 500; }
.cv2-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.25rem 0; }
.badge-pill { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.badge-lowcost { background: #fef3c7; color: #d97706; }
.badge-24h { background: #dcfce7; color: #166534; }
.badge-public { background: #f1f5f9; color: #64748b; }
.cv2-address { font-size: 0.85rem; color: #94a3b8; margin: 0; }
.cv2-schedule { font-size: 0.8rem; color: #94a3b8; margin: 0; display: flex; align-items: center; gap: 4px; }

/* Center Column (Prices) */
.card-v2-center { flex: 2; display: flex; flex-direction: column; justify-content: center; border-left: 1px dashed #e2e8f0; border-right: 1px dashed #e2e8f0; padding: 0 1.5rem; }
.prices-bars-container { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.price-bar-row { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.pb-name { width: 30px; font-weight: 600; color: #64748b; font-size: 0.8rem; }
.pb-track { flex: 1; height: 6px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.pb-fill { height: 100%; border-radius: 99px; }
.pb-val { width: 60px; text-align: right; font-weight: 700; color: #0f172a; font-family: monospace; }
.pb-updated { font-size: 0.75rem; color: #94a3b8; margin-top: 4px; text-align: right; }

/* Right Column */
.card-v2-right { flex: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; min-width: 160px; }
.cv2-rank-badge { background: #fbbf24; color: #78350f; font-weight: 800; padding: 4px 10px; border-radius: 8px; font-size: 0.9rem; margin-bottom: auto; }
.cv2-distance { font-size: 0.9rem; color: #3b82f6; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cv2-link-details { font-size: 0.9rem; color: #3b82f6; text-decoration: none; font-weight: 500; }
.cv2-link-details:hover { text-decoration: underline; }
.btn-cv2-go { background: #2563eb; color: white; padding: 8px 16px; border-radius: 99px; font-size: 0.9rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: background 0.2s; }
.btn-cv2-go:hover { background: #1d4ed8; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .card-v2 { flex-direction: column; align-items: stretch; gap: 1rem; padding: 1rem; }
    .card-v2-center { border: none; padding: 0; border-top: 1px dashed #e2e8f0; border-bottom: 1px dashed #e2e8f0; padding: 1rem 0; }
    .card-v2-right { align-items: center; flex-direction: row; justify-content: space-between; margin-top: 0.5rem; }
    .cv2-rank-badge { position: absolute; top: 1rem; right: 1rem; margin: 0; }
}
