/* ── CSS Variables (Light Mode) ─────────────────────────────────────────── */
:root {
    --bg:            #f0f4f8;
    --surface:       #ffffff;
    --surface-alt:   #f7fafc;
    --border:        #e2e8f0;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
    --shadow:        0 2px 10px rgba(0,0,0,0.09);
    --shadow-lg:     0 4px 20px rgba(0,0,0,0.12);
    --text:          #1a202c;
    --text-muted:    #64748b;
    --accent:        #2563eb;
    --accent-hover:  #1d4ed8;
    --accent-dim:    #eff6ff;
    --success:       #16a34a;
    --danger:        #dc2626;
    --nav-bg:        #1e293b;
    --nav-text:      #e2e8f0;
    --radius:        8px;
    --radius-lg:     12px;
    --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --mono:          'SF Mono', 'Fira Code', Consolas, 'Courier New', monospace;
}

/* ── CSS Variables (Dark Mode) ──────────────────────────────────────────── */
[data-theme="dark"] {
    --bg:            #0f172a;
    --surface:       #1e293b;
    --surface-alt:   #263548;
    --border:        #334155;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
    --shadow:        0 2px 10px rgba(0,0,0,0.4);
    --shadow-lg:     0 4px 20px rgba(0,0,0,0.5);
    --text:          #f1f5f9;
    --text-muted:    #94a3b8;
    --accent:        #60a5fa;
    --accent-hover:  #3b82f6;
    --accent-dim:    #1e3a5f;
    --success:       #4ade80;
    --danger:        #f87171;
    --nav-bg:        #0d1524;
    --nav-text:      #cbd5e1;
}

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

/* scroll-padding-top keeps anchor targets clear of the sticky header
   (search bar + nav) when navigating via the top menu. */
html { height: 100%; scroll-behavior: smooth; scroll-padding-top: 220px; }

body {
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    text-align: center;
    min-height: 100%;
    transition: background 0.25s, color 0.25s;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--accent);
    margin: 12px 0;
    text-align: center;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin: 1.1rem 0 0.4rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin: 6px 0;
}

h3 a, h3 a:link, h3 a:visited { color: var(--accent); }

a:link, a:visited   { color: var(--accent); text-decoration: none; }
a:hover             { color: var(--accent-hover); text-decoration: underline; }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
#holder   { min-height: 100%; position: relative; }
#body     { padding-bottom: 100px; }

.left {
    position: fixed;
    left: 0;
    top: 0;
    padding: 12px;
    z-index: 101;
}

.right {
    display: none;
}

.nmap {
    text-align: center;
    margin: 0 auto;
    padding: 0 6% 48px;
    background: transparent;
}

.lallign {
    display: inline-block;
    text-align: left;
    max-width: 100%;
}

/* ── Header / Logo ──────────────────────────────────────────────────────── */
.left img {
    border-radius: var(--radius);
    transition: opacity 0.2s;
}
.left img:hover { opacity: 0.85; }

/* ── Domain Search Bar ──────────────────────────────────────────────────── */
#dns-search-form {
    margin: 10px auto 6px;
    text-align: center;
}

.dns-search-bar {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 30px;
    box-shadow: var(--shadow);
    padding: 5px 5px 5px 18px;
    gap: 6px;
    max-width: 560px;
    width: 90%;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dns-search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), var(--shadow);
}

.dns-search-bar input[type="text"] {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font);
    flex: 1;
    padding: 4px 0;
    min-width: 0;
}

.dns-search-bar button {
    background: var(--accent);
    border: none;
    border-radius: 24px;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    font-family: var(--font);
    font-weight: 600;
    padding: 8px 20px;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.dns-search-bar button:hover  { background: var(--accent-hover); }
.dns-search-bar button:active { transform: scale(0.97); }

.dns-search-meta {
    margin: 6px 0 2px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.dns-search-meta label { cursor: pointer; display: flex; align-items: center; gap: 5px; }
.dns-search-meta a     { color: var(--text-muted); font-size: 13px; }
.dns-search-meta a:hover { color: var(--accent); }

input[type="checkbox"] { accent-color: var(--accent); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table {
    border-collapse: collapse;
    max-width: 100%;
    width: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 16px;
    margin: 4px auto;
}

table th {
    background: var(--surface-alt);
    color: var(--text);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    overflow-wrap: anywhere;
    vertical-align: top;
    text-align: left;
}

table tr:last-child td { border-bottom: none; }
table tr:nth-child(even) td { background: var(--surface-alt); }

/* Override old universal border on tr */
tr { border: none; }

.tborder {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.tborder table { border: none; box-shadow: none; }

/* ── pre / code ─────────────────────────────────────────────────────────── */
pre {
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    overflow-x: auto;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Section Cards ──────────────────────────────────────────────────────── */
.dns-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin: 12px 0;
    padding: 16px 20px;
    text-align: left;
    min-height: 32px;
    overflow: hidden;
    transition: background 0.25s, border-color 0.25s;
}

/* ── Spinner Placeholders ───────────────────────────────────────────────── */
.dns-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 0;
    color: var(--text-muted);
    font-size: 16px;
    font-style: italic;
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.dns-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: dns-spin 0.75s linear infinite;
    margin-right: 10px;
    flex-shrink: 0;
}

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

.dns-timeout { color: var(--danger); font-style: italic; }
.dns-empty   { color: var(--text-muted); }
.dns-source  { color: var(--text-muted); font-size: 12px; margin-top: 6px; }

/* ── Inline section controls (e.g. propagation record-type selector) ────── */
.dns-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-muted);
}
.dns-controls select {
    font-family: var(--font);
    font-size: 14px;
    padding: 5px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.dns-controls select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Verdict banner (DNSSEC / propagation / NS health) ──────────────────── */
.dns-verdict {
    width: 100%;
    margin: 0 0 14px;
    border-collapse: collapse;
}
.dns-verdict td {
    padding: 12px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--text-muted);
    border-radius: var(--radius);
    line-height: 1.45;
}
.dns-verdict.dns-ok   td { border-left-color: var(--success); }
.dns-verdict.dns-warn td { border-left-color: #d97706; }
.dns-verdict.dns-bad  td { border-left-color: var(--danger); }

/* ── Progress Bar ───────────────────────────────────────────────────────── */
#dns-progress-wrap {
    position: relative;
    height: 26px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 13px;
    margin: 8px auto 16px;
    max-width: 440px;
    overflow: hidden;
}

#dns-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 13px;
    transition: width 0.35s ease;
}

#dns-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

#dns-progress-wrap.done #dns-progress-bar {
    background: linear-gradient(90deg, var(--success), #0d9488);
}

/* ── Sticky header (search bar + nav) ───────────────────────────────────── */
#dns-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    padding: 8px 0;
    margin: 0 0 14px;
    box-shadow: 0 6px 14px -8px rgba(0,0,0,0.35);
}

#dns-sticky #dns-search-form { margin: 0 auto 6px; }

#dns-nav {
    background: var(--nav-bg);
    padding: 7px 6px;
    text-align: center;
    margin: 0;
    border-radius: var(--radius-lg);
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

#dns-nav a {
    display: inline-block;
    color: var(--nav-text);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 5px 10px;
    margin: 1px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

#dns-nav a:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
}

/* ── Dark Mode Toggle ───────────────────────────────────────────────────── */
#theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    user-select: none;
}

#theme-toggle:hover {
    background: var(--surface-alt);
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    transform: scale(1.08);
}

/* ── Input Error Banner ─────────────────────────────────────────────────── */
.dns-error-banner {
    background: var(--surface);
    border: 2px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    margin: 12px auto;
    max-width: 540px;
    padding: 14px 20px;
    text-align: left;
    font-size: 16px;
    line-height: 1.6;
}

/* ── SSL multi-column ───────────────────────────────────────────────────── */
.ssl { column-count: 3; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
#footer {
    text-align: center;
    padding: 16px;
    font-size: 15px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

/* ── Landing page ───────────────────────────────────────────────────────── */
.dns-landing {
    padding: 60px 20px;
    color: var(--text-muted);
}
.dns-landing h1 {
    font-size: 2.2rem;
    margin-bottom: 16px;
    color: var(--accent);
}
.dns-landing p {
    font-size: 1.1rem;
    line-height: 1.7;
}

/* ── iFrames ────────────────────────────────────────────────────────────── */
.iframe-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 16px;
}
.iframe-wrap iframe {
    width: 100%;
    max-width: 1050px;
    height: 700px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ── Misc ───────────────────────────────────────────────────────────────── */
ul {
    text-align: left;
    display: inline-block;
    padding-left: 20px;
    color: var(--text);
}

ul li { margin: 3px 0; }

/* Elapsed time line */
#dns-elapsed {
    font-size: 15px;
    color: var(--text-muted);
    margin: 8px 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    /* Sticky header is shorter on mobile (no meta row, single-line nav). */
    html { scroll-padding-top: 122px; }
    .nmap  { padding: 0 4% 48px; }
    .right { position: static; max-width: 100%; padding: 10px; }
    .right form { width: 90%; margin: 0 auto; text-align: center; }
    .left  { position: static; padding: 10px; }
    /* Keep the sticky header compact: nav scrolls horizontally on one line,
       and the secondary timing/debug row is hidden. */
    #dns-nav {
        white-space: nowrap;
        overflow-x: auto;
        text-align: left;
        -webkit-overflow-scrolling: touch;
    }
    #dns-nav a { font-size: 12px; padding: 4px 6px; }
    #dns-sticky .dns-search-meta { display: none; }
}
