﻿/* ── Tokens ─────────────────────────────────────────────── */
:root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --map-bg: #e8edf3;

    --text: #0f172a;
    --muted: #64748b;
    --soft: #94a3b8;

    --line: #e2e8f0;
    --line-strong: #cbd5e1;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #dbeafe;
    --ok: #16a34a;

    --warn-bg: #fffbeb;
    --warn-text: #92400e;
    --warn-line: #fcd34d;

    --shadow: 0 28px 56px rgba(15, 23, 42, 0.10);
    --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.07);

    --radius: 24px;
    --radius-sm: 14px;
    --page-width: 960px;
}

/* ── Base ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: 'Vazir', Tahoma, Arial, sans-serif;
}

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--text);
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(37, 99, 235, 0.06), transparent 38%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

button {
    font: inherit;
}

/* ── Page shell ─────────────────────────────────────────── */
.page {
    width: min(var(--page-width), calc(100% - 32px));
    min-height: 100dvh;
    margin: 0 auto;
    padding: 22px 0 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: var(--accent);
    box-shadow: var(--shadow-sm);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-copy {
    min-width: 0;
}

.brand-name {
    display: block;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.brand-tagline {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-ghost {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn-ghost:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

.btn-ghost-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* ── Page footer ────────────────────────────────────────── */
.page-footer {
    margin: 0;
    text-align: center;
    color: var(--soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.page-footer strong {
    color: var(--muted);
    font-weight: 800;
}

/* ── Main card ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
    align-items: stretch;
}

/* ── Info column ────────────────────────────────────────── */
.card-info {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px 30px 30px;
}

.info-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
}

.info-ip {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.ip-showcase {
    position: relative;
    padding: 18px 20px 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.ip-showcase-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.ip-showcase-label {
    color: var(--soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ip-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.ip-copy svg {
    width: 14px;
    height: 14px;
}

.ip-copy:hover {
    transform: translateY(-1px);
    color: var(--accent);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.ip-showcase-value {
    display: block;
    width: 100%;
    margin: 0;
    padding: 4px 2px 0;
    direction: ltr;
    text-align: center;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', 'Courier New', monospace;
    font-size: clamp(22px, 2.8vw, 30px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
    color: var(--text);
    background: none;
}

.info-table {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-soft);
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.info-row:last-child {
    border-bottom: 0;
}

.info-row-tag {
    justify-content: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
}

.info-key {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.info-val {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    text-align: end;
    line-height: 1.45;
    word-break: break-word;
}

.info-val-mono {
    direction: ltr;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.copyable {
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.copyable:hover {
    color: var(--accent);
}

.info-foot .btn-text,
.info-foot .btn-primary,
.ip-copy,
.dev-copy,
.icon-btn {
    cursor: pointer;
}

.info-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--warn-text);
    background: var(--warn-bg);
    border: 1px solid var(--warn-line);
    font-size: 11px;
    font-weight: 800;
}

.info-tag svg {
    width: 14px;
    height: 14px;
    stroke: var(--warn-text);
}

.info-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 2px;
}

.icon-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

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

.icon-btn:hover {
    transform: translateY(-1px);
    color: var(--accent);
    border-color: var(--line-strong);
}

.icon-btn-sm {
    width: 32px;
    height: 32px;
}

.btn-primary {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, background 0.18s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: var(--accent-hover);
}

.btn-text {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    padding: 8px 2px;
    transition: color 0.18s ease;
}

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

/* ── Map column ─────────────────────────────────────────── */
.card-map {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--map-bg);
    border-inline-start: 1px solid var(--line);
    cursor: grab;
}

.card-map:active {
    cursor: grabbing;
}

#countryMap {
    flex: 1;
    width: 100%;
    min-height: 330px;
}

#countryMap .jvm-container,
#countryMap svg {
    width: 100%;
    height: 100%;
}

#countryMap .jvm-container {
    cursor: inherit;
}

#countryMap .jvm-tooltip {
    display: none;
}

.map-footer {
    position: absolute;
    z-index: 2;
    left: 14px;
    right: 14px;
    bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.map-country {
    font-size: 14px;
    font-weight: 800;
}

.map-code {
    direction: ltr;
    color: var(--soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

/* ── Developer panel ────────────────────────────────────── */
.dev-panel {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(640px, calc(100% - 32px));
    max-height: min(52vh, 380px);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dev-panel[hidden] {
    display: none;
}

.dev-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.dev-panel-head strong {
    font-size: 13px;
}

.dev-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dev-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.dev-copy svg {
    width: 14px;
    height: 14px;
}

.dev-copy:hover {
    color: var(--accent);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.dev-panel-body {
    overflow: auto;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dev-section-title {
    margin-bottom: 8px;
    color: var(--soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dev-api-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dev-api-url {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    direction: ltr;
    text-align: left;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.dev-api-url.copyable:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--accent);
}

.dev-copy-inline {
    flex-shrink: 0;
}

.dev-api-meta {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.dev-raw pre {
    margin: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    overflow: auto;
    direction: ltr;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.75;
}

.dev-raw pre.copyable:hover {
    color: var(--text);
    background: rgba(37, 99, 235, 0.04);
    border-color: #bfdbfe;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    z-index: 20;
    inset-inline-end: 24px;
    bottom: 24px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── i18n ───────────────────────────────────────────────── */
[data-lang="en"] {
    display: none;
}

html[data-language="en"] {
    direction: ltr;
}

html[data-language="en"] body {
    direction: ltr;
}

html[data-language="en"] [data-lang="fa"] {
    display: none;
}

html[data-language="en"] [data-lang="en"] {
    display: inline;
}

html[data-language="en"] .brand-tagline [data-lang="en"] {
    display: block;
}

html[data-language="en"] .page-footer [data-lang="en"] {
    display: inline;
}

html[data-language="en"] .ip-copy [data-lang="en"] {
    display: inline;
}

html[data-language="en"] .dev-copy [data-lang="en"] {
    display: inline;
}

html[data-language="en"] .dev-copy-inline [data-lang="en"] {
    display: inline;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 760px) {
    .page {
        justify-content: flex-start;
        padding-top: 16px;
        gap: 14px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card-info {
        padding: 22px 20px 24px;
        gap: 18px;
    }

    .info-ip {
        padding-bottom: 18px;
    }

    .card-map {
        border-inline-start: 0;
        border-top: 1px solid var(--line);
        min-height: 240px;
    }

    #countryMap {
        min-height: 240px;
    }

    .brand-tagline {
        display: none;
    }
}

@media (max-width: 480px) {
    .page {
        width: min(var(--page-width), calc(100% - 24px));
        padding-bottom: 20px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .toast {
        inset-inline: 12px;
        bottom: 12px;
        text-align: center;
    }

    .dev-panel {
        bottom: 12px;
        width: calc(100% - 24px);
    }
}
