:root {
    --primary: #4f46e5;       /* Indigo 600 */
    --primary-glow: rgba(79, 70, 229, 0.3);
    --bg-page: #f8fafc;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --green: #10b981;
    --orange: #f59e0b;
    --red: #ef4444;
    --error-bg: #fef2f2;      /* Light Red for error rows */
    --error-border: #fca5a5;
    --border: #e2e8f0;
}

.dns-app {
    font-family: 'Inter', sans-serif;
    max-width: 950px;
    margin: 40px auto;
    color: var(--text-main);
}

/* =========================================
   1. START SCREEN & RADAR ANIMATION
   ========================================= */
.dns-start-view {
    height: 450px;
    background: white;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px -5px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.dns-radar-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: radar 3s infinite ease-out;
}
.ring-1 { width: 100%; height: 100%; animation-delay: 0s; }
.ring-2 { width: 100%; height: 100%; animation-delay: 1s; }
.ring-3 { width: 100%; height: 100%; animation-delay: 2s; }

@keyframes radar {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.btn-primary-pulse {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px var(--primary-glow);
    transition: transform 0.2s;
}
.btn-primary-pulse:hover { transform: scale(1.05); }

.dns-hint { margin-top: 30px; color: var(--text-sub); font-size: 0.9rem; }

/* =========================================
   2. HEADER & CONTROLS
   ========================================= */
.dns-header-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-ghost:hover { background: white; border-color: var(--primary); color: var(--primary); }

.dns-status-pill {
    background: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-sub);
    margin-left: auto;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}
@keyframes blink { 50% { opacity: 0.4; } }

/* =========================================
   3. TABLE & CARDS
   ========================================= */
.dns-table-wrapper {
    overflow-x: auto;
    padding-bottom: 20px;
}

.dns-card-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    min-width: 650px;
}

/* --- Sortable Headers --- */
.dns-card-table th {
    text-align: left;
    color: var(--text-sub);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 20px;
    user-select: none;
}

.sort-head {
    cursor: pointer;
    transition: color 0.2s;
}
.sort-head:hover { color: var(--primary); }

/* Flexbox for icon alignment */
.sort-head-content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sort-icon {
    display: flex;
    opacity: 0.2;
    transition: all 0.2s;
}
.sort-icon svg { width: 14px; height: 14px; }

/* Active Sort State */
.sort-head.active { color: var(--text-main); font-weight: 700; }
.sort-head.active .sort-icon { opacity: 1; color: var(--primary); }
.sort-head.asc .sort-icon { transform: rotate(180deg); }


/* --- Row Cards --- */
.dns-card-row {
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.dns-card-row td {
    padding: 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    position: relative;
}

/* Rounded Corners Hack */
.dns-card-row td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-left: 1px solid #f1f5f9;
    overflow: hidden; /* Important for progress bar clipping */
}
.dns-card-row td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 1px solid #f1f5f9;
}

.dns-card-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.05);
    z-index: 5;
}

/* =========================================
   4. PROGRESS BAR & ERROR STATES
   ========================================= */

/* Tiny Progress Bar */
.dns-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 2;
}
.dns-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s linear;
}

/* Error Row Style */
.row-error td {
    background-color: var(--error-bg) !important;
    border-color: var(--error-border) !important;
}
.val-error {
    color: var(--red);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Rolling Animation Font */
.calculating {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-sub);
    opacity: 0.6;
    font-size: 0.95rem;
}

/* =========================================
   5. PROVIDER INFO & VALUES
   ========================================= */
.provider-info h4 { margin: 0 0 6px 0; font-size: 1.05rem; color: var(--text-main); }
.ip-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-ip {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-ip:hover { background: var(--primary); color: white; border-color: var(--primary); }
.btn-ip.copied { background: var(--green); color: white; border-color: var(--green); }
.btn-ip svg { width: 12px; height: 12px; }

/* Value Coloring */
.stat-val { font-weight: 700; font-family: 'Inter', sans-serif; }
.c-green { color: var(--green); }
.c-orange { color: var(--orange); }
.c-red { color: var(--red); }

/* =========================================
   6. DETAILS ACCORDION
   ========================================= */
.dns-detail-row { display: none; } /* Managed by JS toggle */

.detail-wrapper {
    background: #f8fafc;
    margin: 0 15px 15px 15px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.detail-item {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}