/* =================================================================
   Taxi Fare Calculator - page styles
   Extends global tokens from /assets/css/style.css
   (Polaris-inspired white/black theme)
   ================================================================= */

/* ---------- Layout ---------- */
.page-wrap {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-8) var(--space-5) var(--space-16);
}

.breadcrumb {
    font-size: 13px;
    color: var(--color-text-subdued);
    margin-bottom: var(--space-6);
}
.breadcrumb ol {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.breadcrumb li::after {
    content: "/";
    margin-left: var(--space-2);
    color: var(--color-border-strong);
}
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--color-text-subdued); }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb [aria-current] { color: var(--color-text); }

.page-header {
    text-align: center;
    margin-bottom: var(--space-10);
    padding: 0 var(--space-3);
}
.page-header h1 {
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-4);
    color: var(--color-text);
}
.page-header .lede {
    font-size: clamp(15px, 2.4vw, 17px);
    color: var(--color-text-subdued);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.55;
}

/* ---------- Calculator shell ---------- */
.calc-shell {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
}
.calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-8);
}
@media (max-width: 880px) {
    .calc-grid { grid-template-columns: 1fr; gap: var(--space-6); }
    .calc-shell { padding: var(--space-4); border-radius: var(--radius-lg); }
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Form ---------- */
.calc-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.field .optional {
    color: var(--color-text-subdued);
    font-weight: 400;
}

.field.is-hidden { display: none; }

.field input[type="text"],
.field input[type="number"],
.field select {
    width: 100%;
    height: 48px;                              /* generous tap target on mobile */
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 16px;                           /* 16px prevents iOS zoom-on-focus */
    font-weight: 400;
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.4;
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.field input::placeholder {
    color: var(--color-text-disabled);
    font-family: inherit;
}

/* Disabled state — used when rate-limited or banned */
.field input:disabled,
.field input.is-disabled {
    background: var(--color-surface-subtle);
    color: var(--color-text-disabled);
    cursor: not-allowed;
    border-color: var(--color-border);
}
.field input:disabled::placeholder,
.field input.is-disabled::placeholder {
    color: var(--color-text-disabled);
}

/* two-column layout for currency + distance unit row */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
@media (max-width: 480px) {
    .field-row { grid-template-columns: 1fr; gap: var(--space-4); }
}

/* proper select with custom chevron */
.select-wrap {
    position: relative;
}
.select-wrap::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--color-text-subdued);
    border-bottom: 2px solid var(--color-text-subdued);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
.select-wrap select {
    padding-right: 36px;        /* room for chevron */
    cursor: pointer;
    background-image: none;     /* override any browser default arrow */
}

/* address inputs with role icon */
.input-with-icon { position: relative; }
.input-with-icon input {
    padding-left: 52px;     /* icon (32px) + 12px gap + 8px breathing */
    font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}
.input-with-icon .icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}
.input-with-icon .icon svg {
    display: block;
    width: 16px;
    height: 16px;
}
.input-with-icon .icon-a { background: #1a1a1a; }   /* taxi (driver)   */
.input-with-icon .icon-b { background: #2c6ecb; }   /* passenger       */
.input-with-icon .icon-c { background: #008060; }   /* drop-off        */

/* fuel price field with currency prefix (non-interactive symbol) */
.input-with-prefix {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    transition: border-color .15s, box-shadow .15s;
}
.input-with-prefix:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.input-with-prefix .prefix-static {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 0 var(--space-3);
    background: var(--color-surface-subtle);
    border-right: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-subdued);
}
.input-with-prefix input {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}

/* mileage field with suffix (km/L · MPG) */
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
    transition: border-color .15s, box-shadow .15s;
}
.input-with-suffix:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.input-with-suffix input {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}
.input-with-suffix .suffix-static {
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    background: var(--color-surface-subtle);
    border-left: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text-subdued);
    white-space: nowrap;
}

/* "save this address" toggle */
.save-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px !important;
    font-weight: 400 !important;
    color: var(--color-text-subdued);
    cursor: pointer;
    margin-top: var(--space-1);
}
.save-toggle input[type="checkbox"] {
    width: 16px; height: 16px;
    margin: 0; cursor: pointer;
    accent-color: var(--color-text);
}
.save-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* add / remove stop buttons */
.add-stop-btn {
    background: transparent;
    border: 1px dashed var(--color-border-strong);
    color: var(--color-text-subdued);
    font-size: 13px;
    font-weight: 500;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    width: 100%;
}
.add-stop-btn:hover {
    border-color: var(--color-text);
    color: var(--color-text);
    background: var(--color-surface-subtle);
}
.add-stop-btn .plus {
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}
.add-stop-btn.is-hidden { display: none; }

.remove-stop-btn {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: var(--color-text-subdued);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.remove-stop-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-critical);
}

/* margin segmented control */
.margin-group {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-2);
    align-items: stretch;
}
.seg {
    display: inline-flex;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    padding: 3px;
    height: 48px;
}
.seg-btn {
    border: 0;
    background: transparent;
    color: var(--color-text-subdued);
    font-weight: 600;
    font-size: 14px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s, color .15s;
    min-width: 48px;
}
.seg-btn.is-active {
    background: var(--color-text);
    color: var(--color-primary-text);
}

/* primary button */
.btn-primary {
    position: relative;
    height: 54px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: var(--color-primary-text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary .btn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cmu-spin .8s linear infinite;
    margin-left: var(--space-2);
    display: none;
}
.btn-primary.is-loading .btn-spinner { display: inline-block; }
@keyframes cmu-spin { to { transform: rotate(360deg); } }

.error-msg {
    margin: 0;
    color: var(--color-critical);
    font-size: 13px;
    min-height: 18px;
}

/* ---------- Output ---------- */
.calc-output {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.result-card {
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    min-height: 240px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.result-card::before {
    content: "";
    position: absolute;
    top: -50%; right: -30%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* Force-hide via [hidden] - belt and suspenders against any CSS specificity */
.result-card [hidden] { display: none !important; }

.result-empty {
    color: rgba(255,255,255,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    text-align: center;
    min-height: 200px;
}
.result-empty p { margin: 0; font-size: 14px; }

.result-filled { width: 100%; position: relative; z-index: 1; }
.result-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255,255,255,0.55);
    margin: 0 0 var(--space-3);
    text-align: center;
}
.result-amount {
    font-size: clamp(44px, 9vw, 72px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 0 0 var(--space-6);
    background: linear-gradient(180deg, #ffffff 0%, #c4c4c4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
    text-align: center;
    word-break: break-all;
}

/* trip summary - top-level KPIs */
.trip-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: var(--space-4);
    margin-bottom: var(--space-4);
}
.ts-item {
    text-align: center;
    padding: 0 var(--space-1);
}
.ts-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}
.ts-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
    .ts-value { font-size: 13px; }
}

/* per-leg breakdown (shown when 3 points) */
.leg-breakdown {
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    font-size: 12px;
}
.leg-breakdown:empty { display: none; }
.leg-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.leg-row:last-child { border-bottom: 0; }
.leg-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.leg-dot.dot-a { background: #ffffff; }
.leg-dot.dot-b { background: #6ea8ff; }
.leg-dot.dot-c { background: #4dd6ad; }
.leg-text {
    flex: 1;
    color: rgba(255,255,255,0.85);
}
.leg-meta {
    color: rgba(255,255,255,0.55);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    text-align: right;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: var(--space-4);
    margin-bottom: var(--space-4);
}
.bd-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.bd-key { color: rgba(255,255,255,0.6); }
.bd-val { color: rgba(255,255,255,0.95); font-weight: 600; font-variant-numeric: tabular-nums; }

.btn-ghost {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .15s;
    display: block;
    width: 100%;
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); }
.btn-ghost.is-copied {
    background: var(--color-success);
    border-color: var(--color-success);
}
.btn-ghost--dark {
    background: var(--color-surface-subtle);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}
.btn-ghost--dark:hover { background: var(--color-surface-hover); }

/* map */
.map-wrap {
    position: relative;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: clamp(260px, 40vh, 380px);
}
#map { width: 100%; height: 100%; }
.map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--color-text-disabled);
    background: var(--color-surface-subtle);
    pointer-events: none;
    transition: opacity .3s;
}
.map-placeholder p { margin: 0; font-size: 13px; }
.map-placeholder.is-hidden { opacity: 0; }

/* ---------- Tooltips ---------- */
.tooltip-trigger {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-subdued);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.tooltip-trigger:hover,
.tooltip-trigger:focus {
    background: var(--color-text);
    color: #fff;
    border-color: var(--color-text);
    outline: none;
}

.cmu-tooltip {
    position: absolute;
    z-index: 9999;
    max-width: 280px;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    transition: opacity .15s;
}
.cmu-tooltip::before {
    content: "";
    position: absolute;
    top: -5px;
    left: var(--arrow-x, 16px);
    width: 10px;
    height: 10px;
    background: #1a1a1a;
    transform: rotate(45deg);
    z-index: -1;
}

/* ---------- Captcha modal ---------- */
.cmu-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.cmu-modal[hidden] { display: none; }
.cmu-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
}
.cmu-modal-card {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.cmu-modal-card h3 {
    margin: 0 0 var(--space-2);
    font-size: 18px;
    font-weight: 600;
}
.cmu-modal-card p {
    margin: 0 0 var(--space-4);
    color: var(--color-text-subdued);
    font-size: 14px;
    line-height: 1.5;
}
.captcha-box {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-3);
    min-height: 78px;
}

/* ---------- Ad slot ---------- */
.ad-slot {
    margin: var(--space-10) 0;
    text-align: center;
    min-height: 90px;
}
.ad-slot--rectangle { max-width: 728px; margin-left: auto; margin-right: auto; }

/* ---------- Content sections ---------- */
.content-section {
    max-width: var(--container-narrow);
    margin: var(--space-12) auto 0;
}
.content-section h2 {
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-4);
}
.content-section p { margin: 0 0 var(--space-3); color: var(--color-text); line-height: 1.65; }
.content-section .muted-intro { color: var(--color-text-subdued); margin-bottom: var(--space-5); }

.how-steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.how-steps li {
    counter-increment: step;
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) + 36px);
    position: relative;
    line-height: 1.55;
    color: var(--color-text);
}
.how-steps li::before {
    content: counter(step);
    position: absolute;
    left: var(--space-3);
    top: var(--space-4);
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--color-text);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.how-steps li strong { font-weight: 600; }
.how-steps li em { font-style: normal; font-weight: 600; }

.faq {
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) 0;
}
.faq summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: var(--space-6);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    position: absolute;
    right: 0; top: 0;
    font-size: 22px;
    font-weight: 400;
    color: var(--color-text-subdued);
    transition: transform .2s;
}
.faq[open] summary::after { content: "−"; }
.faq p { margin: var(--space-3) 0 0; color: var(--color-text-subdued); }

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-4);
}
.related-card {
    display: block;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    text-decoration: none !important;
    color: var(--color-text) !important;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.related-card:hover {
    border-color: var(--color-text);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.related-card h3 { margin: 0 0 var(--space-1); font-size: 15px; font-weight: 600; }
.related-card p { margin: 0; font-size: 13px; color: var(--color-text-subdued); }

/* Google Places autocomplete dropdown — keep on-brand */
.pac-container {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-strong);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-sans);
    margin-top: 4px;
    overflow: hidden;
    z-index: 10001;
}
.pac-item {
    padding: 10px 12px;
    border-top: 1px solid var(--color-border);
    font-size: 14px;
    cursor: pointer;
}
.pac-item:first-child { border-top: 0; }
.pac-item:hover { background: var(--color-surface-hover); }
.pac-item-query { font-size: 14px; color: var(--color-text); }
.pac-matched { font-weight: 700; }

/* ---------- Mobile-specific tweaks ---------- */
@media (max-width: 640px) {
    .page-wrap { padding: var(--space-5) var(--space-3) var(--space-12); }
    .page-header { margin-bottom: var(--space-6); }
    .calc-shell { padding: var(--space-3); }
    .result-card { padding: var(--space-6) var(--space-4); }
    .trip-summary { grid-template-columns: 1fr 1fr; }
    .trip-summary .ts-item:nth-child(3) { grid-column: span 2; }
    .ts-value { font-size: 13px; }
    .input-with-prefix .prefix-static { min-width: 48px; padding: 0 var(--space-2); font-size: 13px; }
}
@media (max-width: 380px) {
    .trip-summary { grid-template-columns: 1fr; gap: var(--space-1); }
    .trip-summary .ts-item:nth-child(3) { grid-column: span 1; }
    .ts-item { display: flex; justify-content: space-between; padding: 4px 0; }
    .ts-label { margin-bottom: 0; }
}