/**
 * Abongo CSS - Centralized Styles
 * All pages import this single stylesheet
 */

/* CSS Variables */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1f2937;
    --bg-header: rgb(75, 88, 112);
    --text-primary: #f8f9fa;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #21BBEF;
    --border: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    /* UI accent color - used for card headers, buttons */
    --ui-accent: rgb(75, 88, 112);
    /* UI border color - softer, used for borders and glows */
    --ui-border: rgba(108, 117, 125, 0.6);
    --ui-border-glow: rgba(108, 117, 125, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    color: #212529;
    min-height: 100vh;
    line-height: 1.6;
}

/* Background utility classes */
.bg-secondary {
    background-color: rgb(108, 117, 125);
}

/* ============================================================================
   HEADER
   ============================================================================ */
.header {
    background-color: var(--bg-header);
}

.header-container {
    max-width: 1248px;
    margin: 0 auto;
    padding: 20px 15px 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-left > a:first-child {
    display: flex;
    align-items: center;
}

.logo-img {
    width: 50px;
    margin-right: 8px;
}

.logo-text {
    color: white;
    text-decoration: none;
}

.logo-text:hover {
    text-decoration: none;
    color: white;
}

.logo-text .site-name {
    font-size: 28px;
    font-weight: bold;
    display: block;
    line-height: 1.1;
}

.logo-text .site-description {
    font-size: 14px;
    color: #e5e7eb;
    white-space: nowrap;
}

.header-right {
    text-align: right;
    align-self: flex-start;
}

.your-ip-wrapper {
    text-align: right;
    min-height: 48px;
    color: var(--accent-light);
}

.your-ip-wrapper a {
    color: white;
}

.your-ip-line {
    white-space: nowrap;
}

/* ============================================================================
   SPIDER RIBBON
   ============================================================================ */
.spider-ribbon {
    color: white;
    font-size: 12px;
    padding: 8px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 1248px;
    margin: 0 auto;
}

.spider-ribbon .current-spider {
    color: white;
    font-weight: 500;
}

.spider-ribbon a {
    color: #ccc;
    text-decoration: none;
    margin-left: 8px;
}

.spider-ribbon a:hover {
    color: white;
    text-decoration: none;
}

/* ============================================================================
   MAIN CONTENT CONTAINER
   ============================================================================ */
.main-content {
    max-width: 1248px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================================================
   SEARCH SECTION
   ============================================================================ */
.search-section {
    max-width: 900px;
    margin: 30px auto 40px;
    padding: 0 20px;
}

.search-container {
    max-width: 900px;
    margin: 0 auto;
}

.search-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: stretch;
}

.search-input-wrapper {
    flex: 1 1 350px;
    min-width: 280px;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.1rem;
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    color: #212529;
    outline: none;
    transition: box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 0 12px var(--ui-border-glow);
    box-sizing: border-box;
    height: 100%;
}

.search-input:focus {
    border-color: var(--ui-border);
    box-shadow: 0 0 16px var(--ui-border-glow);
}

.search-input::placeholder {
    color: #6c757d;
}

.search-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.search-action-btn {
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--ui-accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
    line-height: 1.3;
}

.search-action-btn .btn-icon {
    height: 20px;
    width: auto;
}

.search-action-btn:hover {
    background: #5a6268;
}

.search-action-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.search-action-btn .btn-line1 {
    font-size: 1rem;
}

.search-action-btn .btn-line2 {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Legacy single search button (for pages that still use it) */
.search-box {
    display: flex;
    gap: 10px;
}

.search-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--ui-accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #5a6268;
}

.search-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ============================================================================
   SPONSOR SECTION
   ============================================================================ */
.sponsor-container {
    max-width: 800px;
    margin: 0 auto 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
}

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

.sponsor-notice {
    color: #6c757d;
}

.sponsor-notice a {
    color: #3b82f6;
}

/* ============================================================================
   HEALTH CHECK CARD
   ============================================================================ */
.healthcheck-card .card-body {
    padding: 16px;
}

.healthcheck-entries {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.healthcheck-entry {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 150px;
    flex-grow: 1;
    box-sizing: border-box;
}

.healthcheck-entry-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.healthcheck-entry-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.healthcheck-entry-title {
    font-weight: 600;
}

.healthcheck-entry-message {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.3;
    word-wrap: break-word;
}

.healthcheck-sponsor {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #6c757d;
}

.healthcheck-sponsor a {
    color: #3b82f6;
    text-decoration: underline;
}

/* Score 1: Red - Bad */
.healthcheck-score-1 {
    background: rgba(220, 53, 69, 0.25);
    border: 1px solid rgba(220, 53, 69, 0.4);
}
.healthcheck-score-1 .healthcheck-entry-icon {
    color: #ff6b6b;
}

/* Score 2: Amber - Warning */
.healthcheck-score-2 {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.4);
}
.healthcheck-score-2 .healthcheck-entry-icon {
    color: #ffc107;
}

/* Score 3: Grey - Neutral/Informational */
.healthcheck-score-3 {
    background: rgba(108, 117, 125, 0.2);
    border: 1px solid rgba(108, 117, 125, 0.4);
}

/* Score 4: Lime - Good */
.healthcheck-score-4 {
    background: rgba(50, 205, 50, 0.2);
    border: 1px solid rgba(50, 205, 50, 0.4);
}
.healthcheck-score-4 .healthcheck-entry-icon {
    color: #32cd32;
}

/* Score 5: Dark Green - Excellent */
.healthcheck-score-5 {
    background: rgba(25, 135, 84, 0.25);
    border: 1px solid rgba(25, 135, 84, 0.4);
}
.healthcheck-score-5 .healthcheck-entry-icon {
    color: #20c997;
}

/* ============================================================================
   AI SUMMARY CARD
   ============================================================================ */
.ai-field {
    font-weight: 600;
    color: rgb(12,55,135);
}

.ai-summary-meta {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

/* ============================================================================
   RESULTS LAYOUT
   ============================================================================ */
.results-container {
    display: block;
    margin-top: 20px;
}

.results-container.active {
    display: block;
}

/* Results grid - 2 columns */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ============================================================================
   CARD STYLES
   ============================================================================ */
.card {
    background: #fff;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 12px var(--ui-border-glow);
}

/* Full-width card spans both columns */
.card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    padding: 12px 16px;
    background: var(--ui-accent);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.card-header .icon {
    width: 20px;
    height: 20px;
    opacity: 0.9;
}

.card-body {
    padding: 16px;
    color: #212529;
}

/* ============================================================================
   SUB-CARDS (used by NS, Host, MX sections)
   ============================================================================ */
.sub-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.sub-card {
    flex: 1 1 calc(33.33% - 15px);
    min-width: 300px;
    max-width: calc(33.33% - 10px);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    background: #f5f6f8;
}

.sub-card .sub-card-header {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-card .sub-card-header a {
    color: var(--ui-accent);
}

.sub-card .sub-card-header .header-meta {
    font-size: 0.75rem;
    font-weight: 400;
    color: #6c757d;
}

.sub-card .sub-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-card .sub-card-meta .meta-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-family: monospace;
}

.sub-card .sub-card-meta .meta-secondary {
    font-size: 0.8rem;
    color: #495057;
    font-family: monospace;
}

.sub-card .sub-card-ips {
    padding-left: 0;
    border-left: none;
}

.sub-card .dns-ip-block {
    margin-bottom: 0;
}

/* Compact sub-cards for small field:value pairs like ASN info */
.sub-card-compact {
    flex: 0 1 auto;
    min-width: 120px;
    max-width: 200px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 14px;
    background: #f5f6f8;
}

.sub-card-compact .sub-card-header {
    font-weight: 600;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sub-card-compact .sub-card-meta {
    font-size: 0.95rem;
    color: #333;
}

.sub-card-compact .sub-card-meta a {
    color: var(--ui-accent);
    text-decoration: none;
}

.sub-card-compact .sub-card-meta a:hover {
    text-decoration: underline;
}

/* ============================================================================
   DNS IP BLOCK (with flags)
   ============================================================================ */
.dns-ip-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-radius: 6px;
    margin-bottom: 0;
    border-bottom: 1px solid #e9ecef;
}

.dns-ip-block:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.dns-ip-block .flag-img {
    width: 24px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 3px;
}

.dns-ip-block .ip-info {
    flex: 1;
}

.dns-ip-block .ip-address {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
}

.dns-ip-block .ip-address a {
    color: var(--ui-accent);
}

.dns-ip-block .ip-geo {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 2px;
}

.dns-ip-block .ip-geo a {
    color: #6c757d;
}

.dns-ip-block .ip-ptr {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.dns-ip-block .ip-ptr a {
    color: #888;
}

.dns-ip-block .ip-type-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--ui-accent);
    color: white;
    margin-left: 8px;
    font-weight: 600;
}

/* ============================================================================
   COPY BUTTON
   ============================================================================ */
.copy-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.75rem;
    margin-left: 4px;
}

.copy-btn:hover {
    color: var(--ui-accent);
}

.dns-ip-block .copy-btn {
    font-size: 0.7rem;
    color: #888;
    cursor: pointer;
    margin-left: 0;
    padding: 2px 3px;
}

/* ============================================================================
   DNS TABLES
   ============================================================================ */
.dns-section {
    margin-bottom: 20px;
}

.dns-table {
    width: 100%;
    border-collapse: collapse;
}

.dns-table th,
.dns-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    color: #212529;
}

.dns-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dns-table tr:hover {
    background: #f8f9fa;
}

.dns-table .record-type {
    font-family: monospace;
    font-weight: 600;
    color: var(--ui-accent);
}

.dns-table .record-value {
    font-family: monospace;
    word-break: break-all;
}

.dns-record-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
    gap: 15px;
}

.dns-record-row:last-child {
    border-bottom: none;
}

.dns-record-row .record-label {
    min-width: 120px;
    font-weight: 500;
    color: #495057;
}

.dns-record-row .record-value {
    flex: 1;
    word-break: break-word;
}

/* ============================================================================
   SOA FIELDS
   ============================================================================ */
.soa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.soa-field {
    padding: 12px;
    background: #f5f6f8;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.soa-field .field-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.soa-field .field-value {
    font-family: monospace;
    color: #212529;
}

.soa-field .field-human {
    font-size: 0.8rem;
    color: var(--accent-light);
    margin-top: 2px;
}

/* ============================================================================
   TXT RECORDS
   ============================================================================ */
.txt-record {
    font-family: monospace;
    font-size: 0.85rem;
    padding: 10px;
    background: transparent;
    border-radius: 6px;
    margin-bottom: 10px;
    word-break: break-all;
    line-height: 1.4;
}

.txt-record:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   WHOIS
   ============================================================================ */
.whois-section .whois-item {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.whois-section .whois-label {
    min-width: 140px;
    font-weight: 500;
    color: #495057;
}

.whois-section .whois-value {
    color: #212529;
    word-break: break-word;
}

.whois-summary {
    margin-bottom: 15px;
}

.whois-show-all-btn {
    margin-top: 15px;
    padding: 8px 16px;
    background: #f5f6f8;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
    transition: background 0.2s;
}

.whois-show-all-btn:hover {
    background: #e9ecef;
}

.whois-servers-container {
    margin-top: 15px;
}

.whois-servers-container.hidden {
    display: none;
}

.sub-card.whois-server-card {
    flex: 1 1 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.whois-parsed-fields {
    max-height: 300px;
    overflow-y: auto;
}

.whois-field {
    display: flex;
    flex-wrap: wrap;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.whois-field:last-child {
    border-bottom: none;
}

.whois-field-label {
    min-width: 180px;
    padding-right: 15px;
    font-weight: 500;
    color: #495057;
}

.whois-field-value {
    flex: 1;
    word-break: break-word;
    color: #212529;
}

.whois-show-raw-btn {
    margin-top: 10px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #6c757d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #6c757d;
}

.whois-show-raw-btn:hover {
    background: #f8f9fa;
}

.whois-raw-content {
    margin-top: 10px;
    padding: 10px;
    background: #2d2d2d;
    color: #f8f8f2;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.whois-raw-content.hidden {
    display: none;
}

/* ============================================================================
   MAIL SYSTEM
   ============================================================================ */
.mail-section-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-top: 20px;
    margin-bottom: 12px;
}

.mail-section-label:first-child {
    margin-top: 0;
}

.mail-subsection {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    background: #f5f6f8;
    margin-bottom: 15px;
}

/* ============================================================================
   IPv6 CHECKLIST
   ============================================================================ */
.ipv6-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ipv6-checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.ipv6-checklist li:last-child {
    border-bottom: none;
}

.ipv6-checklist .check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ipv6-checklist .check.pass {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}

.ipv6-checklist .check.fail {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

/* ============================================================================
   MAP
   ============================================================================ */
#map {
    height: 350px;
    border-radius: 0 0 8px 8px;
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */
.loading {
    color: #6c757d;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-top-color: var(--ui-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #dee2e6;
    border-top-color: var(--ui-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

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

/* ============================================================================
   LINKS
   ============================================================================ */
.card a {
    color: var(--ui-accent);
    text-decoration: none;
}

.card a:hover {
    text-decoration: underline;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 0.9rem;
}

.footer a {
    color: #6c757d;
}

/* ============================================================================
   ERROR STATES
   ============================================================================ */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 16px;
    color: var(--error);
    margin-bottom: 20px;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */
@media (max-width: 1230px) {
    .sub-card {
        flex: 1 1 calc(50% - 15px);
        max-width: calc(50% - 8px);
    }
}


@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 700px) {
    .sub-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .sub-card-compact {
        flex: 1 1 calc(50% - 8px);
    }
}

@media (max-width: 640px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-right {
        margin-top: 8px;
    }
    .your-ip-wrapper {
        text-align: left;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    body {
        background: white;
        color: black;
    }
    .header,
    .region-ribbon,
    .search-section,
    .footer {
        display: none;
    }
    .card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* ============================================================================
   PROGRESS BAR (horizontal segmented with labels)
   ============================================================================ */
.progress-bar {
    margin-top: 12px;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
    max-height: 28px;
}

.progress-bar.progress-bar-complete {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
}

.progress-segments {
    display: flex;
    gap: 3px;
    height: 22px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-segment {
    flex: 1;
    background: #d1d5db;
    transition: background-color 0.25s ease, color 0.25s ease;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.progress-segment.complete {
    background: #5a9a7c;
    color: #fff;
}
