/* ============================================================
   DNS Propagation Visualizer — style.css
   NOC (Network Operations Center) aesthetic
   Theme: Network ops dark mode
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
    --primary: #00B4D8;
    --secondary: #90E0EF;
    --accent: #FF006E;
    --bg: #0A0F1A;
    --surface: #0D1829;
    --surface2: #111E30;
    --border: rgba(0, 180, 216, 0.18);
    --text: #E2EDF7;
    --text-muted: #6B8BA4;
    --green: #00F5A0;
    --amber: #FFB800;
    --red: #FF3860;
    --radius: 10px;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.55;
}

/* ── Background Grid ─────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(0, 180, 216, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 180, 216, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ── Typography ──────────────────────────────────────────── */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

strong {
    color: var(--secondary);
}

/* ── Glassmorphism card ──────────────────────────────────── */
.glass-card {
    background: rgba(13, 24, 41, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    z-index: 1;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 15, 26, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

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

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

.logo-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 10px;
}

.logo-title {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.2;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition), box-shadow var(--transition);
}

.status-dot.scanning {
    background: var(--amber);
    box-shadow: 0 0 10px var(--amber);
    animation: pulse-amber 1.2s ease-in-out infinite;
}

.status-dot.done {
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
}

.status-dot.error {
    background: var(--red);
    box-shadow: 0 0 10px var(--red);
}

@keyframes pulse-amber {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* ── Main Layout ─────────────────────────────────────────── */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* ── Query Panel ─────────────────────────────────────────── */
.query-panel {
    padding: 20px 24px;
}

.query-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.input-group--narrow {
    flex: 0 0 140px;
}

.compare-toggle-group {
    flex: 0 0 auto;
}

.input-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.input-field,
.select-field {
    background: rgba(0, 180, 216, 0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 10px 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
    appearance: none;
}

.input-field:focus,
.select-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.select-field {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300B4D8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    height: 42px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: block;
    width: 44px;
    height: 24px;
    background: rgba(0, 180, 216, 0.12);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform var(--transition), background var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: rgba(0, 180, 216, 0.25);
    border-color: var(--primary);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: var(--primary);
}

/* Compare Row */
.compare-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.compare-vs {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.12em;
    white-space: nowrap;
    margin-bottom: 0;
    padding-top: 22px;
}

/* Quick providers */
.quick-providers {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-btn {
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--secondary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.quick-btn:hover {
    background: rgba(0, 180, 216, 0.18);
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.9), rgba(0, 180, 216, 0.7));
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    height: 42px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary), rgba(0, 180, 216, 0.85));
    box-shadow: 0 0 18px rgba(0, 180, 216, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary.loading {
    animation: btn-pulse 1s ease-in-out infinite;
}

@keyframes btn-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--secondary);
    font-size: 0.82rem;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color var(--transition), background var(--transition);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(0, 180, 216, 0.1);
}

/* ── Summary Bar ─────────────────────────────────────────── */
.summary-bar {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.summary-val {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.summary-key {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.summary-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

.color-green {
    color: var(--green);
}

.color-amber {
    color: var(--amber);
}

.color-red {
    color: var(--red);
}

.progress-container {
    flex: 1;
    min-width: 120px;
    height: 6px;
    background: rgba(0, 180, 216, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
    animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ── Content Grid ────────────────────────────────────────── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}

/* ── Map Panel ───────────────────────────────────────────── */
.map-panel {
    padding: 0;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot--propagated {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.legend-dot--pending {
    background: var(--amber);
}

.legend-dot--failed {
    background: var(--red);
}

.map-container {
    position: relative;
    background: radial-gradient(ellipse at 50% 55%, #071424 0%, #0A0F1A 100%);
    padding: 12px;
}

#worldMap {
    width: 100%;
    display: block;
}

/* Resolver node circles on SVG */
.resolver-node {
    cursor: pointer;
}

.resolver-node circle.bg-circle {
    transition: r 0.3s ease, opacity 0.3s ease;
}

.resolver-node.status-idle .pulse-ring {
    display: none;
}

.resolver-node .pulse-ring {
    transform-origin: center;
}

.resolver-node.status-scanning .pulse-ring {
    animation: map-pulse 1.5s ease-out infinite;
}

.resolver-node.status-propagated .pulse-ring {
    animation: none;
    opacity: 0;
}

@keyframes map-pulse {
    0% {
        r: 6;
        opacity: 0.8;
    }

    100% {
        r: 18;
        opacity: 0;
    }
}

.map-scope {
    position: absolute;
    background: rgba(10, 18, 30, 0.95);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--secondary);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* ── Results Panel ───────────────────────────────────────── */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(13, 24, 41, 0.72);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
}

.tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 12px 16px;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel--active {
    display: block;
}

.hidden {
    display: none !important;
}

.resolver-list {
    max-height: 520px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Resolver Item ────────────────────────────────────────── */
.resolver-item {
    background: rgba(0, 180, 216, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    animation: slide-in 0.3s ease both;
}

.resolver-item:hover {
    background: rgba(0, 180, 216, 0.09);
    border-color: rgba(0, 180, 216, 0.35);
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

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

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

.resolver-loc {
    display: flex;
    align-items: center;
    gap: 8px;
}

.resolver-flag {
    font-size: 1rem;
    line-height: 1;
}

.resolver-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.resolver-ip {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.resolver-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge--propagated {
    background: rgba(0, 245, 160, 0.12);
    color: var(--green);
    border: 1px solid rgba(0, 245, 160, 0.3);
}

.badge--scanning {
    background: rgba(255, 184, 0, 0.12);
    color: var(--amber);
    border: 1px solid rgba(255, 184, 0, 0.3);
    animation: badge-blink 1s ease infinite;
}

.badge--failed {
    background: rgba(255, 56, 96, 0.12);
    color: var(--red);
    border: 1px solid rgba(255, 56, 96, 0.3);
}

.badge--idle {
    background: rgba(107, 139, 164, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(107, 139, 164, 0.2);
}

@keyframes badge-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.resolver-record {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--secondary);
    word-break: break-all;
    line-height: 1.5;
}

.resolver-record.empty {
    color: var(--text-muted);
    font-style: italic;
}

.resolver-ttl {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.ttl-label {
    font-size: 0.67rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ttl-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--primary);
}

.ttl-bar {
    flex: 1;
    height: 3px;
    background: rgba(0, 180, 216, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.ttl-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 1s linear;
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
    max-height: 540px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 180, 216, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    animation: slide-in 0.3s ease both;
}

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.tl-propagated {
    background: var(--green);
}

.tl-failed {
    background: var(--red);
}

.tl-checking {
    background: var(--amber);
}

.timeline-text {
    flex: 1;
}

.timeline-name {
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 500;
}

.timeline-detail {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 2px;
}

.timeline-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Diff Panel ──────────────────────────────────────────── */
.diff-panel {
    max-height: 540px;
    overflow-y: auto;
    padding: 12px;
}

.diff-compare-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    margin-bottom: 12px;
}

.diff-domain {
    flex: 1;
    padding: 6px 12px;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    color: var(--secondary);
    text-align: center;
}

.diff-vs {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.75rem;
}

.diff-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.diff-cell {
    flex: 1;
    padding: 8px 10px;
    border-radius: 6px;
    word-break: break-all;
}

.diff-cell--same {
    background: rgba(0, 245, 160, 0.07);
    color: var(--green);
    border: 1px solid rgba(0, 245, 160, 0.2);
}

.diff-cell--diff {
    background: rgba(255, 0, 110, 0.08);
    color: var(--red);
    border: 1px solid rgba(255, 0, 110, 0.25);
}

.diff-cell--missing {
    background: rgba(107, 139, 164, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-style: italic;
}

/* ── Export Bar ──────────────────────────────────────────── */
.export-bar {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.export-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.export-info {
    margin-left: auto;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
    text-align: center;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes sweep {
    from {
        stroke-dashoffset: 1000;
    }

    to {
        stroke-dashoffset: 0;
    }
}

.sweep-line {
    stroke-dasharray: 1000;
    animation: sweep 1.5s ease forwards;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .results-panel {
        max-height: none;
    }

    .resolver-list {
        max-height: 360px;
    }
}

@media (max-width: 640px) {
    .main {
        padding: 14px;
    }

    .query-row {
        flex-direction: column;
    }

    .input-group--narrow {
        flex: 1;
    }

    .summary-bar {
        gap: 12px;
    }

    .summary-divider {
        display: none;
    }

    .panel-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}