/* ═══════════════════════════════════════════════════════════
   Solís FM Digital — Tasa BCV WebApp
   Diseño nativo estilo iOS · Tema claro premium
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #f2f2f7;
    --bg-elevated: #ffffff;
    --card: #ffffff;
    --label: #000000;
    --label-2: #3c3c43;
    --label-3: #8e8e93;
    --separator: rgba(60, 60, 67, 0.12);
    --fill: rgba(120, 120, 128, 0.12);
    --fill-2: rgba(120, 120, 128, 0.08);

    --blue: #007aff;
    --blue-dark: #0a63cc;
    --green: #34c759;
    --red: #ff3b30;
    --orange: #ff9500;
    --binance: #f0b90b;

    --radius-l: 22px;
    --radius-m: 16px;
    --radius-s: 11px;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(0, 0, 0, 0.06);
    --shadow-pop: 0 8px 30px rgba(0, 0, 0, 0.16);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tabbar-h: 66px;

    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
}

/* ── Modo oscuro (estilo iOS dark) ── */
body.dark {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --card: #1c1c1e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.42);
    --separator: rgba(255, 255, 255, 0.10);
    --fill: rgba(120, 120, 128, 0.32);
    --fill-2: rgba(120, 120, 128, 0.18);
    --blue: #0a84ff;
    --shadow-card: 0 0 0 0.5px rgba(255, 255, 255, 0.07);
}

body {
    transition: background-color 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--label);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ───────────── HEADER ───────────── */
.app-header {
    padding: calc(var(--safe-top) + 14px) 20px 10px;
    background: var(--bg);
    flex-shrink: 0;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.big-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.1;
}

.subtitle {
    font-size: 13px;
    color: var(--label-3);
    margin-top: 3px;
    font-weight: 500;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--bg-elevated);
    color: var(--blue);
    box-shadow: var(--shadow-card);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.icon-btn:active {
    transform: scale(0.9);
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.icon-btn.spinning svg {
    animation: spin 0.7s linear infinite;
}

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

/* ───────────── SCROLL AREA ───────────── */
.scroll-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: viewIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

/* ───────────── CARD BASE ───────────── */
.card {
    background: var(--card);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-card);
    margin-bottom: 14px;
}

/* ───────────── HERO CARD (Dólar) ───────────── */
.hero-card {
    background: linear-gradient(155deg, #0a84ff 0%, #0060df 100%);
    border-radius: var(--radius-l);
    padding: 20px;
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 100, 223, 0.34);
    margin-bottom: 14px;
}

.hero-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.hero-badge img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
}

/* ── Indicador de tendencia (estilo casa de bolsa) ── */
.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 20px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--label-3);
    background: var(--fill-2);
}

.trend svg {
    width: 9px;
    height: 9px;
}

.trend.up {
    color: var(--green);
    background: rgba(52, 199, 89, 0.16);
}

.trend.down {
    color: var(--red);
    background: rgba(255, 59, 48, 0.16);
}

.hero-head .trend {
    background: #ffffff;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.18);
}

.hero-head .trend.up {
    color: #1d9b40;
}

.hero-head .trend.down {
    color: #e23b30;
}

.hero-head .trend.flat {
    color: #6b6b70;
}

.mini-card .trend {
    margin-top: 8px;
}

.hero-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 18px 0 6px;
}

.hero-value .bs-prefix {
    font-size: 22px;
    font-weight: 600;
    opacity: 0.8;
}

.hero-value span:last-child {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -1.5px;
    font-variant-numeric: tabular-nums;
}

.hero-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.hero-foot #rate-usd-sub {
    font-size: 12.5px;
    opacity: 0.82;
    font-weight: 500;
}

.ghost-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 13px;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s;
}

.ghost-btn:active {
    transform: scale(0.93);
}

.ghost-btn svg {
    width: 14px;
    height: 14px;
}

/* ───────────── MINI GRID (Euro/Binance) ───────────── */
.mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.mini-card {
    background: var(--card);
    border-radius: var(--radius-m);
    padding: 15px;
    box-shadow: var(--shadow-card);
}

.mini-top {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
}

.mini-top img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.mini-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--label-3);
}

.mini-value {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.6px;
    font-variant-numeric: tabular-nums;
}

.mini-value::after {
    content: ' Bs.';
    font-size: 12px;
    font-weight: 600;
    color: var(--label-3);
}

/* ───────────── ROW CARD (atajo) ───────────── */
.row-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: none;
    border-radius: var(--radius-m);
    padding: 14px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    margin-bottom: 14px;
    transition: transform 0.15s;
}

.row-card:active {
    transform: scale(0.98);
}

.row-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.row-icon.brecha {
    background: linear-gradient(160deg, #ff9f0a, #ff7a00);
    color: #fff;
}

.row-icon svg {
    width: 21px;
    height: 21px;
}

.row-text {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.row-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.row-sub {
    display: block;
    font-size: 12px;
    color: var(--label-3);
    margin-top: 2px;
}

.row-tag {
    font-size: 14px;
    font-weight: 800;
    color: var(--orange);
}

.row-chevron {
    width: 16px;
    height: 16px;
    color: var(--label-3);
    flex-shrink: 0;
}

.source-note {
    text-align: center;
    font-size: 11.5px;
    color: var(--label-3);
    margin-top: 4px;
}

/* ───────────── BRECHA: GAUGE ───────────── */
.gauge-card {
    padding: 22px 20px 18px;
    text-align: center;
}

.gauge-wrap {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0 auto;
}

.gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-track {
    fill: none;
    stroke: var(--fill);
    stroke-width: 16;
}

.gauge-fill {
    fill: none;
    stroke: var(--orange);
    stroke-width: 16;
    stroke-linecap: round;
    stroke-dasharray: 528;
    stroke-dashoffset: 528;
    transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-pct {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--orange);
}

.gauge-cap {
    font-size: 12px;
    color: var(--label-3);
    font-weight: 600;
    margin-top: -2px;
}

.gauge-desc {
    font-size: 13px;
    color: var(--label-2);
    margin-top: 14px;
    line-height: 1.45;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.compare-card {
    background: var(--card);
    border-radius: var(--radius-m);
    padding: 15px;
    box-shadow: var(--shadow-card);
    border-top: 3px solid var(--separator);
}

.compare-card.bcv {
    border-top-color: var(--blue);
}

.compare-card.bin {
    border-top-color: var(--binance);
}

.compare-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--label-3);
}

.compare-value {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    color: var(--label-3);
    font-weight: 600;
}

.compare-value b {
    font-size: 23px;
    font-weight: 800;
    color: var(--label);
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.info-card {
    padding: 4px 16px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    font-size: 14px;
    color: var(--label-2);
}

.info-row+.info-row {
    border-top: 1px solid var(--separator);
}

.info-row b {
    font-size: 15px;
    font-weight: 700;
    color: var(--label);
}

/* ───────────── SEGMENTED CONTROL ───────────── */
.segmented {
    display: flex;
    background: var(--fill);
    border-radius: 10px;
    padding: 2px;
    margin-bottom: 14px;
}

.seg-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--label-2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.seg-btn.active {
    background: var(--bg-elevated);
    color: var(--label);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ───────────── CHART ───────────── */
.chart-card {
    padding: 14px 10px 10px;
}

#chart-canvas {
    width: 100% !important;
    height: 220px !important;
    display: block;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat {
    background: var(--card);
    border-radius: var(--radius-s);
    padding: 13px 10px;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.stat-label {
    font-size: 11px;
    color: var(--label-3);
    font-weight: 600;
}

.stat-val {
    display: block;
    margin-top: 5px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}

/* ───────────── CALCULADORA ───────────── */
.calc-card {
    padding: 18px;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--label-3);
    margin-bottom: 7px;
}

.amount-input {
    width: 100%;
    border: none;
    background: var(--fill-2);
    border-radius: var(--radius-m);
    padding: 16px;
    font-size: 30px;
    font-weight: 800;
    color: var(--label);
    letter-spacing: -0.6px;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.amount-input::placeholder {
    color: var(--label-3);
    opacity: 0.55;
}

.swap-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin-top: 16px;
}

.cur-field {
    flex: 1;
    min-width: 0;
}

.cur-select {
    width: 100%;
    border: none;
    background: var(--fill-2);
    border-radius: var(--radius-s);
    padding: 13px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--label);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.swap-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: var(--blue);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    transition: transform 0.2s;
}

.swap-btn:active {
    transform: rotate(180deg) scale(0.9);
}

.swap-btn svg {
    width: 19px;
    height: 19px;
}

.result-card {
    background: linear-gradient(155deg, #34c759, #28a847);
    border-radius: var(--radius-l);
    padding: 20px;
    text-align: center;
    color: #fff;
    box-shadow: 0 8px 22px rgba(52, 199, 89, 0.32);
    margin-bottom: 14px;
}

.result-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
}

.result-value {
    display: block;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.result-rate {
    display: block;
    font-size: 12px;
    opacity: 0.82;
    margin-top: 4px;
    font-weight: 500;
}

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
}

.quick-amounts button {
    border: none;
    background: var(--card);
    border-radius: var(--radius-s);
    padding: 13px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--blue);
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s;
}

.quick-amounts button:active {
    transform: scale(0.93);
}

/* ───────────── ALERTAS ───────────── */
.alert-hero {
    padding: 26px 22px;
    text-align: center;
}

.alert-bell {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    margin: 0 auto 14px;
    background: linear-gradient(160deg, #ff9f0a, #ff7a00);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 20px rgba(255, 122, 0, 0.36);
}

.alert-bell svg {
    width: 30px;
    height: 30px;
}

.alert-hero h3 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.alert-hero p {
    font-size: 13.5px;
    color: var(--label-2);
    margin-top: 7px;
    line-height: 1.45;
}

.feature-list {
    padding: 6px 18px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 0;
    font-size: 14px;
    color: var(--label-2);
}

.feature+.feature {
    border-top: 1px solid var(--separator);
}

.feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

/* ───────────── BOTONES GENERALES ───────────── */
.primary-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: var(--blue);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 15px;
    border-radius: var(--radius-m);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.32);
    transition: transform 0.15s;
    margin-bottom: 10px;
}

.primary-btn.big {
    padding: 17px;
    font-size: 16px;
}

.primary-btn:active {
    transform: scale(0.97);
}

.primary-btn svg {
    width: 18px;
    height: 18px;
}

.text-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--red);
    font-size: 14px;
    font-weight: 600;
    padding: 10px;
    cursor: pointer;
}

/* ───────────── TAB BAR ───────────── */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(249, 249, 249, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--separator);
    display: flex;
    z-index: 500;
}

.tab {
    flex: 1;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--label-3);
    cursor: pointer;
    padding-top: 8px;
}

.tab-ico {
    width: 52px;
    height: 32px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    transition: background 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.18s;
}

.tab svg {
    width: 24px;
    height: 24px;
    transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab-lbl {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    transition: color 0.18s, font-weight 0.18s;
}

.tab.active {
    color: var(--blue);
}

.tab.active .tab-ico {
    background: rgba(0, 122, 255, 0.14);
}

.tab.active svg {
    transform: translateY(-1px) scale(1.08);
}

.tab.active .tab-lbl {
    font-weight: 700;
}

.tab:active .tab-ico {
    transform: scale(0.84);
}

body.dark .tab.active .tab-ico {
    background: rgba(10, 132, 255, 0.24);
}

/* ───────────── BOTTOM SHEET ───────────── */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
    z-index: 900;
}

.sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background: var(--bg-elevated);
    border-radius: 22px;
    padding: 8px 8px calc(8px + var(--safe-bottom));
    transform: translateY(130%);
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 901;
    box-shadow: var(--shadow-pop);
}

.sheet.open {
    transform: translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: var(--fill);
    margin: 6px auto 10px;
}

.sheet-title {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--label-3);
    padding-bottom: 10px;
}

.sheet-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 13px;
    border: none;
    background: var(--fill-2);
    border-radius: 13px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--label);
    cursor: pointer;
    margin-bottom: 7px;
}

.sheet-option:active {
    background: var(--fill);
}

.sheet-ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: #fff;
}

.sheet-ico svg {
    width: 21px;
    height: 21px;
}

.sheet-ico.wa {
    background: #25d366;
}

.sheet-ico.tg {
    background: #2aabee;
}

.sheet-ico.cp {
    background: #8e8e93;
}

.sheet-cancel {
    width: 100%;
    border: none;
    background: var(--card);
    border-radius: 13px;
    padding: 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
    cursor: pointer;
    margin-top: 4px;
    box-shadow: var(--shadow-card);
}

/* ───────────── TOAST ───────────── */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
    transform: translateX(-50%) translateY(24px);
    background: rgba(0, 0, 0, 0.86);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: 22px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s, transform 0.26s;
    z-index: 950;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ───────────── SKELETON LOADING ───────────── */
.loading .hero-value span:last-child,
.loading .mini-value span {
    color: transparent;
    background: var(--fill);
    border-radius: 7px;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ───────────── HEADER ACTIONS ───────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

/* ───────────── AJUSTES MODO OSCURO ───────────── */
body.dark .app-header,
body.dark body {
    background: #000000;
}

body.dark .tab-bar {
    background: rgba(18, 18, 20, 0.86);
    border-top-color: rgba(255, 255, 255, 0.09);
}

body.dark .toast {
    background: rgba(255, 255, 255, 0.95);
    color: #000000;
}

body.dark .seg-btn.active {
    background: #636366;
    color: #ffffff;
}

body.dark .icon-btn {
    background: #1c1c1e;
}

body.dark .sheet-cancel {
    background: #2c2c2e;
}
