/*
 * IPLOOK MVNO Business Case Calculator
 * 品牌主色：#16163F
 * 布局使用逻辑属性（margin-inline / padding-inline / inset-inline），
 * 以便阿拉伯语与波斯语在 dir="rtl" 下自动镜像。
 */

:root {
    --brand: #16163F;
    --brand-600: #23236b;
    --brand-100: #ececf6;
    --ink: #1b1b23;
    --muted: #5c5c6b;
    --line: #dcdce7;
    --bg: #ffffff;
    --bg-soft: #f6f6fa;
    --success: #10683d;
    --success-bg: #e7f5ec;
    --error: #a01d2b;
    --error-bg: #fdecee;
    --warn: #8a5a00;
    --warn-bg: #fff5e0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(22, 22, 63, .08), 0 8px 24px rgba(22, 22, 63, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", "Noto Sans Hebrew", Tahoma, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

body.has-lang-bar { padding-bottom: 110px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand-600); }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Header ---------- */
.site-header {
    background: var(--brand);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.header-inner {
    display: flex; flex-wrap: wrap; gap: 12px 24px;
    align-items: center; justify-content: space-between; padding-block: 14px;
}
.brand { display: inline-flex; align-items: center; color: #fff; text-decoration: none; }
/* Logo 占位图：替换 /assets/images/logo-placeholder.svg 即可，无需改动页面代码 */
.site-logo { display: block; height: 34px; width: auto; }
.footer-logo { display: block; height: 30px; width: auto; margin-bottom: 8px; }
.brand-mark { font-weight: 700; letter-spacing: .06em; font-size: 1.15rem; }
.brand-sub { font-size: .78rem; opacity: .75; }
.main-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.main-nav a { color: rgba(255, 255, 255, .85); text-decoration: none; font-size: .95rem; }
.main-nav a:hover, .main-nav a.is-active { color: #fff; text-decoration: underline; }
.nav-mail { border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 3px 12px; }

.lang-switcher select {
    background: #fff; color: var(--ink); border: 1px solid var(--line);
    border-radius: 999px; padding: 6px 10px; font: inherit; font-size: .9rem; min-width: 120px;
}

/* ---------- Hero ---------- */
.hero { background: var(--brand); color: #fff; padding-block: 34px 30px; }
.hero h1 { color: #fff; }
.hero-sub { margin: 0; max-width: 62ch; color: rgba(255, 255, 255, .85); }

/* ---------- Sections ---------- */
.section-title { margin-top: 32px; }
.section-intro { color: var(--muted); max-width: 70ch; }
.calc-section { padding-bottom: 24px; }
.inquiry-section { padding-bottom: 48px; }

.calc-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start; margin-top: 18px;
}

.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.card-title { margin-bottom: 14px; color: var(--brand); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.field input, .field select, .field textarea {
    width: 100%; font: inherit; color: var(--ink); background: #fff;
    border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--brand-600); outline-offset: 1px; border-color: var(--brand-600);
}
.field textarea { resize: vertical; }
.field-hint { margin: 4px 0 0; font-size: .82rem; color: var(--muted); }
.field-error { margin: 4px 0 0; font-size: .85rem; color: var(--error); }
.req { color: var(--error); }
.currency-note { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* 询盘表单：一行只放一个字段，输入框全宽 */
.field-row { display: grid; gap: 0; grid-template-columns: 1fr; }

.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consent, .attach-note { font-size: .85rem; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.form-status { font-size: .9rem; color: var(--muted); }

.btn {
    display: inline-block; font: inherit; font-size: .95rem; cursor: pointer;
    border-radius: 8px; padding: 10px 18px; border: 1px solid transparent; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary[disabled] { opacity: .65; cursor: progress; }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #86161f; border-color: #86161f; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: inline-flex; margin: 0; }
.admin-delete-form { margin-block: 14px; }

/* ---------- Results ---------- */
.result-item {
    padding: 12px 0; border-bottom: 1px dashed var(--line);
    display: grid; grid-template-columns: 1fr; gap: 2px;
}
.result-item:last-child { border-bottom: 0; }
.result-label { font-weight: 600; font-size: .92rem; }
.result-value {
    font-size: 1.35rem; font-weight: 700; color: var(--brand);
    direction: ltr; unicode-bidi: isolate; display: inline-block;
}
.result-unit { font-size: .85rem; color: var(--muted); margin-inline-start: 6px; }
.result-hint { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.result-note { margin: 6px 0 0; font-size: .85rem; color: var(--warn); }

.assumptions { margin-top: 18px; }
.assumptions p { color: var(--muted); margin: 0; }

/* ---------- 初步估算区间 ---------- */
.estimate-section { padding-bottom: 8px; }
.estimate-scenario { max-width: 340px; }
.estimate-rows { margin-top: 12px; }
.estimate-row {
    padding: 10px 0; border-bottom: 1px dashed var(--line);
    display: grid; grid-template-columns: 1fr; gap: 2px;
}
.estimate-row:last-child { border-bottom: 0; }
.estimate-label { font-weight: 600; font-size: .92rem; }
.estimate-value {
    font-size: 1.15rem; font-weight: 700; color: var(--brand);
    direction: ltr; unicode-bidi: isolate; display: inline-block;
}
.estimate-value.estimate-na {
    font-size: .92rem; font-weight: 600; color: var(--warn);
    direction: inherit; unicode-bidi: normal;
}
.estimate-unit { font-size: .85rem; color: var(--muted); margin-inline-start: 6px; }
.estimate-note { margin: 8px 0 0; font-size: .84rem; color: var(--muted); }
.estimate-row.is-unavailable .estimate-label { color: var(--muted); }

/* ---------- 申请详细估算 ---------- */
.detailed-prompt { margin-bottom: 18px; }
.detailed-prompt .btn { margin-top: 12px; }
.optional-flag { font-weight: 400; font-size: .82rem; color: var(--muted); }
.inquiry-success { margin-top: 18px; }
.inquiry-success p { color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { border-radius: 8px; padding: 12px 16px; margin-block: 16px; border: 1px solid; }
.alert p { margin: 4px 0 0; }
.alert-success { background: var(--success-bg); border-color: #bfe3cd; color: var(--success); }
.alert-error { background: var(--error-bg); border-color: #f3c4ca; color: var(--error); }
.alert-warn { background: var(--warn-bg); border-color: #f0dcae; color: var(--warn); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); margin-top: 32px; }
.footer-inner {
    display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-block: 26px;
}
.footer-brand { font-weight: 700; color: var(--brand); margin: 0 0 4px; }
.footer-title { font-weight: 700; margin: 0 0 6px; }
.footer-note, .footer-block p { font-size: .88rem; color: var(--muted); }
.footer-langs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.footer-langs a { font-size: .9rem; text-decoration: none; }
.footer-langs a:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 12px; }
.footer-bottom p { margin: 0; font-size: .82rem; color: var(--muted); }

/* ---------- Language suggestion bar ---------- */
.lang-suggest {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40;
    background: #fff; border-top: 3px solid var(--brand); box-shadow: 0 -4px 20px rgba(22, 22, 63, .12);
}
.lang-suggest-inner {
    max-width: 1120px; margin-inline: auto; padding: 12px 20px;
    display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between;
}
.lang-suggest-text { margin: 0; font-size: .95rem; }
.lang-suggest-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Static pages ---------- */
.static-section { padding-block: 32px 48px; }
.static-card { margin-bottom: 14px; }
.static-card p { margin: 0; color: var(--muted); }
.back-link { margin-top: 20px; }

/* ---------- Admin ---------- */
.admin-body { background: var(--bg-soft); }
.admin-header { background: var(--brand); color: #fff; }
.admin-header-inner { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding-block: 12px; }
.admin-header .brand-mark { color: #fff; }
.admin-title { font-weight: 600; }
.admin-user { font-size: .85rem; opacity: .85; }
.admin-logout { margin-inline-start: auto; }
.admin-main { padding-block: 24px 40px; }
.admin-main .btn-ghost { background: #fff; }
.admin-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.admin-card h1 { font-size: 1.35rem; }
.admin-card h2 { font-size: 1.05rem; margin-top: 22px; color: var(--brand); }
.admin-form { max-width: 360px; }
.admin-meta, .admin-note { font-size: .85rem; color: var(--muted); }
.admin-table, .detail-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table { display: block; overflow-x: auto; white-space: nowrap; }
.admin-table th, .admin-table td, .detail-table th, .detail-table td {
    border: 1px solid var(--line); padding: 8px 10px; text-align: start; vertical-align: top;
}
.admin-table th, .detail-table th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
.detail-table th { width: 220px; }
.cell-url span, .cell-url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: inline-block; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); }
.message-box {
    white-space: pre-wrap; word-break: break-word; background: var(--bg-soft);
    border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; font: inherit; font-size: .9rem;
}
.pager { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.pager-info { font-size: .85rem; color: var(--muted); }

/* ---------- 工具中心 ---------- */
.hub-section { padding-block: 32px 48px; }
.hub-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.hub-card { display: block; text-decoration: none; color: inherit; }
.hub-card h2 { font-size: 1.15rem; color: var(--brand); }
.hub-card p { color: var(--muted); font-size: .92rem; }
.hub-card:hover { border-color: var(--brand); }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-links a { font-size: .9rem; text-decoration: none; }

/* ---------- 分组标题 / 免责声明 ---------- */
.group-title { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.group-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.disclaimer { margin: 0; font-size: .88rem; color: var(--muted); }
.cost-hint { margin-top: -6px; }

/* ---------- 结果补充项 / 图表 ---------- */
.result-subitem { padding-block: 8px; border-top: 1px dashed var(--line); }
.result-subitem .result-value { font-size: 1.1rem; }
.card-title, .chart-title { font-weight: 700; }
.chart { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.chart-title { margin: 0 0 10px; font-size: .92rem; color: var(--brand); }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.bar-label { font-size: .82rem; color: var(--muted); }
.bar-track { background: var(--bg-soft); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--brand-600); border-radius: 999px; transition: width .25s ease; }
.bar-fill-alt { background: #6b6b93; }
.bar-fill-profit { background: var(--success); }
.bar-value { font-size: .82rem; font-variant-numeric: tabular-nums; }
.bar-value.is-negative { color: var(--error); }

.schedule-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.schedule-table th, .schedule-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: start; }
.schedule-table th { background: var(--bg-soft); font-weight: 600; }
.schedule-table td { font-variant-numeric: tabular-nums; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
    .header-inner { justify-content: flex-start; }
    .main-nav { order: 3; width: 100%; }
    .lang-switcher { order: 2; }
    .lang-suggest-inner { flex-direction: column; align-items: stretch; }
    .lang-suggest-actions .btn { flex: 1; text-align: center; }
    .detail-table th { width: 140px; }
}
