/**
 * =============================================================================
 *  Project:        Enterramon
 *  Filename:       assets/css/tools.css
 *  Location:       /var/www/enterramon.com/public_html/new/assets/css/tools.css
 *  Description:    Styles for the tool pages. Moved out of the page templates.
 *  Version:        1.0
 *  Copyright :     (c) 2026 InlineBlack. All rights reserved.
 * =============================================================================
 *
 *  The live tool templates each carried their own inline <style> block for the
 *  results table. Inline styles are re-sent with every page view and cannot be
 *  cached; moving them here means one cached request instead of ~3.5 KB of
 *  markup on every tool page load.
 *
 *  The rules below are the live template's, unchanged, so the table renders
 *  exactly as it does now.
 */

#resultsContainer table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
        margin-top: 0.5rem;
        border: 0px;
    }

    #resultsContainer thead th {
        padding: 0.5rem 0.75rem;
        font-weight: 600;
        border: 0px solid #f1f5f9;
        border-bottom: 2px solid #979797;
        text-align: left;
    }

    #resultsContainer tbody td {
        padding: 0.45rem 0.75rem;
        border: 0px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
    }

    #resultsContainer tbody tr:last-child td {
        border-bottom: none;
    }

    #resultsContainer th:nth-child(1),
    #resultsContainer td:nth-child(1) {
        width: 1%;
        white-space: nowrap;
        text-align: left;
    }

    #resultsContainer th:nth-child(2),
    #resultsContainer td:nth-child(2),
    #resultsContainer th:nth-child(3),
    #resultsContainer td:nth-child(3) {
        width: 50%;
        text-align: right;
    }


/* =============================================================================
   TRACEROUTE RESULTS TABLE
   =============================================================================
   Moved verbatim from the inline <style> in the live theme's
   templates/server-trace-tool.php. It was omitted on the first port of that
   page, which left the hop table completely unstyled - no cell padding and no
   column widths, so every column ran together:
   "#IP / HostnameAvg RTTLocation".

   Scoped by #trace-table, exactly as live scopes it, so nothing here can
   affect another tool page.

   NOTE: the first rule reads `#trace-table table`, which selects a table
   INSIDE #trace-table - but #trace-table IS the table. So it matches nothing
   and never has, on live either. It is kept as-is rather than "fixed", because
   correcting it would give the table width:100% and border-collapse:collapse
   and so change how the borders render. Fixing it is a design decision, not a
   porting one.
   ============================================================================= */

#trace-table table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
        margin-top: 0.5rem;
        border: 0px;
    }

    #trace-table thead th {
        padding: 0.5rem 0.75rem;
        font-weight: 600;
        border: 0px solid #f1f5f9;
        border-bottom: 2px solid #979797;
        text-align: left;
    }

    #trace-table tbody td {
        padding: 0.45rem 0.75rem;
        border: 0px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
    }

    #trace-table tbody tr:last-child td {
        border-bottom: none;
    }

    #trace-table th:nth-child(1),
    #trace-table td:nth-child(1) {
        width: 1%;
        white-space: nowrap;
        text-align: left;
    }

    #trace-table th:nth-child(2),
    #trace-table td:nth-child(2),
    #trace-table th:nth-child(3),
    #trace-table td:nth-child(3),
    #trace-table th:nth-child(4),
    #trace-table td:nth-child(4) {
        width: 33.33%;
        text-align: right;
    }


/* =============================================================================
   DNS LOOKUP RESULTS TABLES
   =============================================================================
   Moved verbatim from the inline <style> in the live theme's
   templates/server-dns-tool.php. Scoped by #dns-tools, exactly as live scopes
   it, so it cannot leak onto another tool page.

   Unlike the traceroute block, this one is correctly scoped: `#dns-tools table`
   selects the tables INSIDE the #dns-tools section, which is where they are.
   ============================================================================= */

#dns-tools table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    border: 0px;
}
#dns-tools thead th{
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    border: 0px solid #f1f5f9;
    border-bottom: 2px solid #979797;
    text-align: right;
}
#dns-tools tbody td {
    padding: 0.45rem 0.75rem;
    border: 0px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}
#dns-tools tbody tr:last-child td {
    border-bottom: none;
}
#dns-tools th:nth-child(1),
#dns-tools td:nth-child(1) {
    width: 1%;
    white-space: nowrap;
    text-align: left;
}
#dns-tools th:nth-child(2),
#dns-tools td:nth-child(2),
#dns-tools th:nth-child(3),
#dns-tools td:nth-child(3) {
    width: 50%;
    text-align: right;
}
.answer-row:not(:last-child) {
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}
.badge-spf { background: #10b981; color: white; }
.badge-dmarc { background: #3b82f6; color: white; }
.badge-verification { background: #8b5cf6; color: white; }
#dns-tools .txt-expand-btn,
#dns-tools .txt-expand-btn:hover,
#dns-tools .txt-expand-btn:focus {
    color: #f2994a !important;
    border: none !important;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
}
#dns-tools .txt-badge-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 6px;
    white-space: nowrap;
}
#dns-tools .txt-expand-btn {
    background: rgba(242, 153, 74, 0.12) !important;
}
#dns-tools .txt-expand-btn:hover,
#dns-tools .txt-expand-btn:focus {
    background: rgba(242, 153, 74, 0.22) !important;
}
#dns-tools .txt-expand-btn .material-symbols-outlined {
    font-size: 16px;
}
.geo-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 16px;
    background: #f1f5f9;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 4px;
}
.badge-consensus-success { background: #10b981; color: white; }
.badge-consensus-warning { background: #f59e0b; color: white; }
.badge-consensus-error { background: #ef4444; color: white; }
#dns-aggregate-header {
    display: none;
    margin-bottom: 1rem;
}


/* =============================================================================
   SERVER CHECK RESULTS
   =============================================================================
   Moved verbatim from the inline <style> in the live theme's
   templates/server-check-tool.php. Scoped by #resultsContainer and the
   server-check specific ids, exactly as live scopes it.
   ============================================================================= */

/* Badge styles */
    .badge-success {
        background-color: #22c55e;
        color: white;
    }

    .badge-error {
        background-color: #ef4444;
        color: white;
    }

    /* Toggle switch (matches the Creative/global switch on the site) */
    .switch-label {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        cursor: pointer;
        font-size: 0.85rem;
        user-select: none;
    }

    .switch-label input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .switch-track {
        position: relative;
        width: 2.5rem;
        height: 1.4rem;
        background: #cbd5e1;
        border-radius: 999px;
        transition: background-color 0.2s ease;
        flex-shrink: 0;
    }

    .switch-track::before {
        content: "";
        position: absolute;
        top: 0.15rem;
        left: 0.15rem;
        width: 1.1rem;
        height: 1.1rem;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.2s ease;
        box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    }

    .switch-label input[type="checkbox"]:checked + .switch-track {
        background: #ff7a2c;
    }

    .switch-label input[type="checkbox"]:checked + .switch-track::before {
        transform: translateX(1.1rem);
    }

    .switch-label input[type="checkbox"]:focus-visible + .switch-track {
        outline: 2px solid #f4b400;
        outline-offset: 2px;
    }

    /* Response headers table */
    .header-table {
        width: 100%;
        border-collapse: collapse;
    }

    .header-table th,
    .header-table td {
        padding: 0.55rem 0.75rem;
        border-bottom: 1px solid rgba(0,0,0,0.08);
        text-align: left;
        font-size: 0.85rem;
        vertical-align: top;
    }

    .header-table th {
        opacity: 0.6;
        font-weight: 600;
    }

    .header-table td.header-name {
        white-space: nowrap;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-weight: 600;
    }

    .header-table td.header-value {
        word-break: break-word;
        opacity: 0.85;
    }

    .header-status-pass {
        color: #22c55e;
        font-weight: 600;
        white-space: nowrap;
    }

    .header-status-miss {
        color: #ef4444;
        font-weight: 600;
        white-space: nowrap;
    }

    .header-status-info {
        opacity: 0.5;
        white-space: nowrap;
    }

    .copy-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 6px 10px;
    }


/* =============================================================================
   ROBOTS.TXT TESTER
   =============================================================================
   Moved verbatim from the inline <style> in the live theme's
   templates/server-robots-tool.php.
   ============================================================================= */

/* Results table styling */
    #resultsContainer table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }

    #resultsContainer thead th {
        padding: 0.5rem 0.75rem;
        font-weight: 600;
        border-bottom: 2px solid #979797;
        text-align: left;
    }

    #resultsContainer tbody td {
        padding: 0.45rem 0.75rem;
        border-bottom: 1px solid #f1f5f9;
    }

    #resultsContainer tbody tr:last-child td {
        border-bottom: none;
    }

    .rules-list {
        max-height: 900px;
        overflow-y: auto;
        border-radius: 0.5rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
        position: relative;
    }

    .rules-list::after {
        content: "";
        position: sticky;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 20px;
        pointer-events: none;
        background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.25));
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .rules-list.has-overflow::after {
        opacity: 1;
    }

    .rules-list.at-bottom::after {
        opacity: 0;
    }

    .rule-item {
        padding: 0.25rem 0.5rem;
        border-bottom: 1px solid #e2e8f0;
        font-family: monospace;
        font-size: 0.8rem;
    }

    .rule-item:last-child {
        border-bottom: none;
    }

    .rule-allow {
        color: #22c55e;
    }

    .rule-disallow {
        color: #ef4444;
    }

    .rule-comment {
        color: #64748b;
        font-style: italic;
    }


/* =============================================================================
   BROKEN LINK CHECKER / SITE CRAWL
   =============================================================================
   Moved verbatim from the inline <style> in the live theme's
   templates/server-site-crawl-tool.php.
   ============================================================================= */

#resultsContainer table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }

    #resultsContainer thead th {
        padding: 0.5rem 0.75rem;
        font-weight: 600;
        border-bottom: 2px solid #979797;
        text-align: left;
    }

    #resultsContainer tbody td {
        padding: 0.45rem 0.75rem;
        border-bottom: 1px solid #f1f5f9;
    }

    #resultsContainer tbody tr:last-child td {
        border-bottom: none;
    }

    .rules-list {
        max-height: 400px;
        overflow-y: auto;
        border-radius: 0.5rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
        position: relative;
    }

    .rules-list::after {
        content: "";
        position: sticky;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 20px;
        pointer-events: none;
        background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.25));
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .rules-list.has-overflow::after {
        opacity: 1;
    }

    .rule-item {
        padding: 0.25rem 0.5rem;
        border-bottom: 1px solid #e2e8f0;
        font-family: monospace;
        font-size: 0.8rem;
    }

    .rule-item:last-child {
        border-bottom: none;
    }

    .rule-allow {
        color: #22c55e;
    }

    .rule-disallow {
        color: #ef4444;
    }

    .rule-comment {
        color: #64748b;
        font-style: italic;
    }

    .crawl-summary-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }


/* ==========================================================================
   CYBER ATTACK MAP  (/cyber-attack-map/)

   Moved verbatim out of flytrap.php's inline <style> block, following the
   same approach used for the traceroute and DNS tables: page-specific CSS
   lives here with the rest of the tool styles rather than inline.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Monospace cells inside the attack map's subnet tables.

   These cells carry font-family:monospace, and Chrome's monospace quirk then
   resolves their font-size from the default FIXED size (13px) instead of the
   16px inherited from the table - so the subnet lists rendered smaller here
   than on live, which showed 16px. font-size:inherit does NOT defeat the
   quirk; an explicit length does. 1rem keeps it tied to the root size rather
   than hardcoding the pixels.
   -------------------------------------------------------------------------- */
#sources .enterra-table td[style*="monospace"] {
    font-size: 1rem;
    line-height: 24px;
}

#sources .flex-sb {
    gap: 10px !important;
}
#sources .ent-chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#sources .ent-row {
    display: grid;
    grid-template-columns: minmax(0, 45%) minmax(60px, 1fr) 52px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    width: 100%;
}
#sources .ent-label,
#sources .ent-track,
#sources .ent-count {
    width: auto;
    flex: none;
    float: none;
    position: static;
}
#sources .ent-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#sources .ent-track {
    height: 8px;
    border-radius: 4px;
    background: var(--color-secondary-container);
    overflow: hidden;
    min-width: 0;
}
#sources .ent-bar {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: 4px;
    background: #ff7a2c;
}
#sources .ent-count {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
