/* =================================================================
   tools/ipv4-subnet.css
   Auto-extracted from math.css (2026-05-11).
   Loaded via config/js-manifest.php → templates/partials/head-styles.php.
   ================================================================= */

/* =================================================================
   IPv4 SUBNET CALCULATOR — visualizations
   ================================================================= */

.math-ipv4-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--math-primary-soft), transparent);
    border: 1px solid var(--math-border);
    border-radius: var(--math-radius-md);
    margin-bottom: 6px;
}

.math-ipv4-summary-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.math-ipv4-summary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--math-text-muted);
}

.math-ipv4-summary-value {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 20px;
    font-weight: 800;
    color: var(--math-text);
    letter-spacing: 0.01em;
}

.math-ipv4-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1.5px solid;
    background: var(--math-surface);
}

.math-ipv4-scope-badge[data-scope="public"] {
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
    background: rgba(2, 132, 199, 0.08);
}
.math-ipv4-scope-badge[data-scope="private"] {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.3);
    background: rgba(22, 163, 74, 0.08);
}
.math-ipv4-scope-badge[data-scope="loopback"] {
    color: #9333ea;
    border-color: rgba(147, 51, 234, 0.3);
    background: rgba(147, 51, 234, 0.08);
}
.math-ipv4-scope-badge[data-scope="linklocal"] {
    color: #ea580c;
    border-color: rgba(234, 88, 12, 0.3);
    background: rgba(234, 88, 12, 0.08);
}
.math-ipv4-scope-badge[data-scope="multicast"] {
    color: #db2777;
    border-color: rgba(219, 39, 119, 0.3);
    background: rgba(219, 39, 119, 0.08);
}
.math-ipv4-scope-badge[data-scope="reserved"],
.math-ipv4-scope-badge[data-scope="broadcast"] {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.3);
    background: rgba(100, 116, 139, 0.08);
}

.math-ipv4-scope-note {
    margin: 10px 0 4px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--math-text-soft);
    background: var(--math-surface-alt);
    border-left: 3px solid var(--math-primary);
    border-radius: 0 8px 8px 0;
}

.math-ipv4-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--math-border-light);
    text-align: left;
}

.math-ipv4-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--math-text-soft);
    margin-bottom: 12px;
}

.math-ipv4-section-title i {
    color: var(--math-primary);
    font-size: 14px;
}

/* ─── 32-bit grid: octets with network/host coloring ─────────── */
.math-ipv4-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: var(--math-text-soft);
    margin-bottom: 10px;
}

.math-ipv4-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.math-ipv4-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid;
}

.math-ipv4-legend-swatch.is-network {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--math-primary);
}

.math-ipv4-legend-swatch.is-host {
    background: rgba(16, 185, 129, 0.22);
    border-color: var(--math-success);
}

.math-ipv4-bitgrid {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 4px;
    background: var(--math-surface-alt);
    border-radius: 10px;
    border: 1px solid var(--math-border-light);
}

.math-ipv4-octet-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.math-ipv4-octet-bits {
    display: flex;
    gap: 2px;
}

.math-ipv4-bit {
    position: relative;
    width: 26px;
    height: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 1.5px solid transparent;
    border-radius: 5px;
    background: var(--math-surface);
    transition: all 0.18s ease;
}

.math-ipv4-bit.is-network {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.35);
}

.math-ipv4-bit.is-host {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
}

.math-ipv4-bit.is-boundary {
    box-shadow: 3px 0 0 0 var(--math-primary);
}

.math-ipv4-bit-val {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--math-text);
    line-height: 1;
}

.math-ipv4-bit.is-network .math-ipv4-bit-val {
    color: var(--math-primary);
}

.math-ipv4-bit.is-host .math-ipv4-bit-val {
    color: var(--math-success);
}

.math-ipv4-bit-pos {
    font-family: 'SF Mono', monospace;
    font-size: 8px;
    color: var(--math-text-muted);
    line-height: 1;
}

.math-ipv4-octet-dec {
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--math-text);
    background: var(--math-surface);
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid var(--math-border);
}

.math-ipv4-octet-sep {
    font-size: 20px;
    font-weight: 800;
    color: var(--math-text-muted);
    align-self: center;
    padding: 0 2px;
    margin-top: -18px;
}

/* ─── AND / OR operation visualization ─────────── */
.math-ipv4-op-viz {
    margin-bottom: 18px;
    padding: 14px 12px;
    border: 1px solid var(--math-border-light);
    border-radius: 10px;
    background: var(--math-surface-alt);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.math-ipv4-op-viz:last-child {
    margin-bottom: 0;
}

.math-ipv4-op-block-title {
    font-size: 13px;
    color: var(--math-text-soft);
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--math-border);
}

.math-ipv4-op-block-title strong {
    color: var(--math-text);
}

.math-ipv4-op-symbol {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px;
    background: var(--math-primary);
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.math-ipv4-op-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: max-content;
    margin-bottom: 4px;
}

.math-ipv4-op-label {
    flex: 0 0 auto;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: right;
}

.math-ipv4-op-label-main {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--math-text-soft);
}

.math-ipv4-op-label-sub {
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    color: var(--math-text-muted);
    font-weight: 600;
}

.math-ipv4-op-cells {
    display: flex;
    gap: 1px;
}

.math-ipv4-op-cell {
    width: 20px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--math-text-muted);
    background: var(--math-surface);
    border-radius: 3px;
}

.math-ipv4-op-cell.is-on {
    color: var(--math-text);
}

.math-ipv4-op-cell.has-octet-break {
    margin-left: 6px;
}

.math-ipv4-op-cell.is-tint-mask.is-on {
    background: rgba(99, 102, 241, 0.16);
    color: var(--math-primary);
}

.math-ipv4-op-cell.is-tint-network.is-on {
    background: rgba(99, 102, 241, 0.25);
    color: var(--math-primary);
}

.math-ipv4-op-cell.is-tint-wildcard.is-on {
    background: rgba(16, 185, 129, 0.16);
    color: var(--math-success);
}

.math-ipv4-op-cell.is-tint-broadcast.is-on {
    background: rgba(234, 88, 12, 0.18);
    color: #ea580c;
}

.math-ipv4-op-sign-line {
    margin: 4px 0 4px 100px;
    font-family: 'SF Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--math-primary);
}

.math-ipv4-op-divider-line {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--math-border) 10%, var(--math-border) 90%, transparent);
    margin: 6px 0 6px 100px;
}

.math-ipv4-op-hint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--math-primary-soft);
    color: var(--math-text);
    font-size: 12.5px;
    line-height: 1.5;
}

/* ─── Range scale ─────────── */
.math-ipv4-scale {
    padding: 56px 16px 84px;
    position: relative;
}

.math-ipv4-scale-track {
    position: relative;
    height: 10px;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.12), rgba(16, 185, 129, 0.12), rgba(234, 88, 12, 0.15));
    border-radius: 999px;
    border: 1px solid var(--math-border);
}

.math-ipv4-scale-usable {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 8px;
    background: linear-gradient(to right, rgba(16, 185, 129, 0.5), rgba(16, 185, 129, 0.3));
    border-radius: 999px;
}

.math-ipv4-scale-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.math-ipv4-scale-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--math-surface);
    border: 3px solid var(--math-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.math-ipv4-scale-marker.is-network .math-ipv4-scale-dot { border-color: var(--math-primary); }
.math-ipv4-scale-marker.is-broadcast .math-ipv4-scale-dot { border-color: #ea580c; }
.math-ipv4-scale-marker.is-firsthost .math-ipv4-scale-dot,
.math-ipv4-scale-marker.is-lasthost .math-ipv4-scale-dot { border-color: var(--math-success); }

.math-ipv4-scale-label {
    position: absolute;
    top: 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--math-text-soft);
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
}

.math-ipv4-scale-label code {
    display: inline-block;
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--math-text);
    background: var(--math-surface);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--math-border);
    margin-top: 2px;
    text-transform: none;
    letter-spacing: 0;
}

/* Put network/firsthost labels below, broadcast/lasthost above for readability */
.math-ipv4-scale-marker.is-firsthost .math-ipv4-scale-label {
    top: auto;
    bottom: 16px;
}

.math-ipv4-scale-marker.is-lasthost .math-ipv4-scale-label {
    top: auto;
    bottom: 16px;
}

.math-ipv4-scale-pin {
    position: absolute;
    top: -40px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--math-primary);
    z-index: 3;
}

.math-ipv4-scale-pin i {
    font-size: 22px;
    line-height: 1;
}

.math-ipv4-scale-pin-label {
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--math-primary);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.math-ipv4-scale-caption {
    margin-top: 4px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--math-text-soft);
    background: var(--math-surface-alt);
    border-radius: 8px;
    text-align: center;
}

.math-ipv4-scale-caption strong {
    color: var(--math-text);
}

/* ─── Facts grid ─────────── */
.math-ipv4-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.math-ipv4-fact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: var(--math-surface-alt);
    border: 1px solid var(--math-border-light);
    border-radius: 8px;
}

.math-ipv4-fact-key {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--math-text-muted);
}

.math-ipv4-fact-val {
    font-family: 'SF Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--math-text);
    word-break: break-all;
}

.math-ipv4-fact-val.math-ipv4-fact-mono {
    font-size: 11px;
    word-break: break-all;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .math-ipv4-summary-value {
        font-size: 16px;
    }
    .math-ipv4-bit {
        width: 22px;
        height: 28px;
    }
    .math-ipv4-bit-val {
        font-size: 12px;
    }
    .math-ipv4-bit-pos {
        font-size: 7px;
    }
    .math-ipv4-octet-sep {
        font-size: 16px;
    }
    .math-ipv4-octet-dec {
        font-size: 11px;
        padding: 1px 5px;
    }
    .math-ipv4-op-cell {
        width: 16px;
        height: 22px;
        font-size: 11px;
    }
    .math-ipv4-op-label {
        min-width: 68px;
    }
    .math-ipv4-op-label-main {
        font-size: 10px;
    }
    .math-ipv4-op-label-sub {
        font-size: 10px;
    }
    .math-ipv4-op-sign-line,
    .math-ipv4-op-divider-line {
        margin-left: 78px;
    }
    .math-ipv4-scale {
        padding: 62px 10px 96px;
    }
    .math-ipv4-scale-label {
        font-size: 9px;
    }
    .math-ipv4-scale-label code {
        font-size: 10px;
    }
}

/* ─── IPv4 Subnet result rows ─────────────────────────── */
.math-subnet-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--math-border-light);
    font-size: 14px;
}

.math-subnet-row:last-child {
    border-bottom: none;
}

.math-subnet-row strong {
    color: var(--math-text-soft);
    font-size: 12px;
    min-width: 110px;
    flex-shrink: 0;
}

.math-subnet-val {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 700;
    color: var(--math-primary);
    font-size: 15px;
}
