/* ─── Variables ─────────────────────────────────────────── */
:root {
    --bg:        #080a0d;
    --surface:   #0f1116;
    --surface-2: #161a22;
    --surface-3: #1d2130;
    --border:    rgba(255,255,255,0.07);
    --border-hi: rgba(255,255,255,0.14);

    --text:      #eef2fa;
    --text-2:    #8b93a8;
    --text-3:    #4f566b;

    --gold:      #f5a623;
    --gold-2:    #fcd16a;
    --gold-dim:  rgba(245,166,35,0.12);
    --gold-glow: rgba(245,166,35,0.25);

    --blue:      #4f9cf9;
    --blue-dim:  rgba(79,156,249,0.10);

    --r-card:    16px;
    --r-sm:      8px;

    --font-display: 'Bebas Neue', sans-serif;
    --font-body:    'DM Sans', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ─── Noise overlay ──────────────────────────────────────── */
.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ─── Header ─────────────────────────────────────────────── */
header {
    position: relative;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    background: rgba(8,10,13,0.9);
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.15em;
    color: var(--bg);
    background: var(--gold);
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

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

.logo-main {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.05em;
    color: var(--text);
    line-height: 1;
}

.logo-sub {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 500;
}

.header-badge {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    border: 1px solid rgba(245,166,35,0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* ─── Main ───────────────────────────────────────────────── */
main {
    flex: 1;
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    padding: 0 24px 80px;
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
    padding: 72px 0 48px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: -80px; right: -80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.hero-title {
    display: flex;
    flex-direction: column;
    line-height: 0.92;
    margin-bottom: 20px;
}

.hero-line-1 {
    font-family: var(--font-display);
    font-size: clamp(52px, 8vw, 88px);
    letter-spacing: 0.02em;
    color: var(--text-2);
    font-weight: 400;
}

.hero-line-2 {
    font-family: var(--font-display);
    font-size: clamp(72px, 11vw, 128px);
    letter-spacing: 0.01em;
    color: var(--text);
    font-weight: 400;
    -webkit-text-stroke: 1px rgba(255,255,255,0.08);
}

.hero-sub {
    font-size: 15px;
    color: var(--text-2);
    font-weight: 300;
    max-width: 480px;
    line-height: 1.6;
}

/* ─── Search card ────────────────────────────────────────── */
.search-section { margin-bottom: 48px; }

.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: border-color 0.3s;
}

@media (max-width: 480px) {
    .search-card { padding: 16px; gap: 16px; }
    .search-input-row input { font-size: 16px; } /* evita zoom en iOS */
    .year-chip { font-size: 16px; padding: 8px 14px; }
}

.search-card:focus-within {
    border-color: var(--border-hi);
}

/* ─── Search input ───────────────────────────────────────── */
.search-box-wrap {
    position: relative;
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0 14px;
    transition: border-color 0.2s, background 0.2s;
}

.search-input-row:focus-within {
    border-color: var(--gold);
    background: var(--surface-3);
}

.search-icon {
    color: var(--text-3);
    font-size: 16px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.search-input-row:focus-within .search-icon {
    color: var(--gold);
}

.search-input-row input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    padding: 14px 0;
}

.search-input-row input::placeholder {
    color: var(--text-3);
    font-weight: 400;
}

.search-input-row input:disabled::placeholder {
    color: var(--text-3);
    opacity: 0.5;
}

.search-clear {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.search-clear:hover { color: var(--text); }

/* ─── Dropdown ───────────────────────────────────────────── */
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--surface-2);
    border: 1px solid var(--border-hi);
    border-radius: var(--r-sm);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    box-shadow: 0 20px 48px rgba(0,0,0,0.55);
    animation: fadeSlideDown 0.15s ease both;
}

.search-dropdown.open { display: block; }

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

.search-result-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.1s;
    min-height: 44px;
}

.search-result-item:hover,
.search-result-item.active {
    background: rgba(245,166,35,0.07);
}

.result-marca {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-3);
    min-width: 96px;
    flex-shrink: 0;
}

.result-modelo {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

@media (max-width: 480px) {
    .search-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 12px 16px;
        min-height: 52px;
    }

    .result-marca {
        min-width: unset;
        font-size: 10px;
    }

    .result-modelo {
        font-size: 15px;
    }

    .search-dropdown {
        max-height: 55vh;
    }
}

.search-result-item mark {
    background: none;
    color: var(--gold);
    font-weight: 700;
}

.search-no-results {
    padding: 16px;
    color: var(--text-3);
    font-size: 13px;
    text-align: center;
}

.search-no-results em { font-style: normal; color: var(--text-2); }

.result-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-result-item:hover .result-badge,
.search-result-item.active .result-badge {
    opacity: 1;
}

/* ─── Variant chips ──────────────────────────────────────── */
.variant-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.variant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variant-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: left;
}

.variant-chip:hover {
    border-color: rgba(245,166,35,0.5);
    color: var(--text);
}

.variant-chip.active {
    background: rgba(245,166,35,0.1);
    border-color: var(--gold);
    color: var(--gold);
}

@media (max-width: 480px) {
    .variant-chip { font-size: 14px; padding: 9px 14px; width: 100%; }
}

/* ─── Year chips ─────────────────────────────────────────── */
.year-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
}

.year-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.year-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.04em;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.2;
}

.year-chip:hover {
    border-color: rgba(245,166,35,0.5);
    color: var(--gold);
}

.year-chip.active {
    background: rgba(245,166,35,0.1);
    border-color: var(--gold);
    color: var(--gold);
}

.year-loading {
    font-size: 13px;
    color: var(--text-3);
}

/* ─── Button ─────────────────────────────────────────────── */
#btn-consultar {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--gold);
    color: #080a0d;
    border: none;
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    letter-spacing: 0.01em;
}

#btn-consultar:hover:not(:disabled) {
    background: var(--gold-2);
    box-shadow: 0 0 28px var(--gold-glow);
}

#btn-consultar:active:not(:disabled) {
    transform: scale(0.98);
}

#btn-consultar:disabled {
    background: var(--surface-3);
    color: var(--text-3);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-icon {
    font-size: 18px;
    transition: transform 0.2s;
}

#btn-consultar:hover:not(:disabled) .btn-icon {
    transform: translateX(3px);
}

/* ─── Result section ─────────────────────────────────────── */
.result-section {
    display: none;
    flex-direction: column;
    gap: 0;
    animation: fadeSlideUp 0.4s ease both;
}

.result-section.visible { display: flex; }

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Loading */
.result-loading {
    display: none;
    align-items: center;
    gap: 14px;
    color: var(--text-2);
    font-size: 14px;
    padding: 32px 0;
}

.result-loading.active { display: flex; }

.loading-ring {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Error */
.result-error {
    display: none;
    align-items: center;
    gap: 12px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--r-sm);
    padding: 16px 20px;
    color: #fca5a5;
    font-size: 14px;
}

.result-error.active { display: flex; }

.error-icon { font-size: 18px; }

/* Content */
.result-content {
    display: none;
    flex-direction: column;
    gap: 2px;
}

.result-content.active { display: flex; }

/* Result header */
.result-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card) var(--r-card) 0 0;
    padding: 24px 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.result-vehicle {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-marca {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
}

.result-modelo {
    font-family: var(--font-display);
    font-size: 28px;
    letter-spacing: 0.03em;
    color: var(--text);
    line-height: 1;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.result-tag {
    font-size: 11px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.result-year {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--gold);
    letter-spacing: 0.05em;
}

/* Valor block */
.result-valor-block {
    background: linear-gradient(135deg, #0f1116 0%, #13161f 100%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 40px 28px;
    position: relative;
    overflow: hidden;
}

.result-valor-block::before {
    content: '$';
    position: absolute;
    right: -10px;
    top: -20px;
    font-family: var(--font-display);
    font-size: 200px;
    color: rgba(245,166,35,0.04);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.result-valor-label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
    margin-bottom: 8px;
}

.result-valor {
    font-family: var(--font-display);
    font-size: clamp(52px, 8vw, 80px);
    letter-spacing: 0.02em;
    color: var(--gold);
    line-height: 1;
    text-shadow: 0 0 60px var(--gold-glow);
}

.result-periodo {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-3);
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* Chart block */
.chart-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--r-card) var(--r-card);
    padding: 24px 28px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
}

.chart-info {
    font-size: 12px;
    color: var(--text-3);
}

.chart-wrap {
    position: relative;
    height: 180px;
}

/* ─── Footer ─────────────────────────────────────────────── */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-3);
    flex-wrap: wrap;
    text-align: center;
}

footer strong { color: var(--text-2); }

.footer-dot { color: var(--text-3); }
