/*
 * Subnet Calculator Pro - Global Stylesheet
 * Version: 3.7 (Implements new dropdown navigation styles)
 * Author: RCG Websites
 * Description: Global styles for the application, including layout, light/dark themes, and UI components.
*/

:root {
    --primary-color: #1e88e5; /* Blue 600 */
    --primary-color-dark: #155fa0; /* Darker Blue for hover/accents */
    --background-light: #f4f6f9; /* Light grey - Main body background */
    --background-dark: #1c1c1e; /* Very dark grey/almost black - Dark mode body */
    --text-light: #212529; /* Dark grey for text on light background */
    --text-dark: #e0e0e0; /* Light grey for text on dark background */
    --card-bg-light: #ffffff; /* White - Background for content boxes */
    --card-bg-dark: #2c2c2e; /* Darker grey for content boxes in dark mode */
    --border-light: #dee2e6; /* Light grey border */
    --border-dark: #444444; /* Medium grey border for dark mode */
    --input-bg-light: #ffffff; /* White for inputs */
    --input-bg-dark: #3a3a3c; /* Dark background for inputs */
    --button-text: #ffffff; /* White text for primary buttons */
    --link-color: var(--primary-color); /* Default link color */
    --success-color: #28a745;
    --success-color-dark: #1f7a35;
    --error-color: #dc3545;
    --error-color-dark: #a71d2a;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    --highlight-bg-light: #e9f5fe;
    --highlight-border-light: #c3e0f5;
    --highlight-bg-dark: #26323f;
    --highlight-border-dark: #37475a;

    --container-border-radius: 10px;
    --section-spacing: 40px;
    --code-bg-light: rgba(0,0,0,0.06);
    --code-bg-dark: rgba(255,255,255,0.1);
    --code-font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* Basic Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: 'Roboto', sans-serif;
    background: var(--background-light);
    color: var(--text-light);
    line-height: 1.6;
    font-size: 1rem;
    transition: background-color 0.3s, color 0.3s;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body.dark-mode {
    background-color: var(--background-dark);
    color: var(--text-dark);
    --link-color: #64b5f6; /* Lighter blue for links in dark mode */
}

/* Accessibility - Focus Visible */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(30, 136, 229, 0.2);
}
[tabindex="0"]:focus-visible, details > summary:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}
.modal-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 0px;
    box-shadow: none;
}

/* Tooltip */
.tooltip-icon {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: 8px; width: 20px; height: 20px;
    border-radius: 50%; background: #adb5bd; color: var(--card-bg-light);
    font-size: 13px; font-weight: bold; cursor: help;
    position: relative; user-select: none; transition: background-color 0.2s;
    vertical-align: middle;
}
.tooltip-icon::before { content: "i"; font-style: italic; }
.tooltip-icon:hover, .tooltip-icon:focus { background-color: #6c757d; }
.tooltip-content {
    display: none; position: absolute;
    background: rgba(0,0,0,0.88); color: #fff;
    padding: 8px 12px; border-radius: 6px;
    font-size: 0.9rem; font-style: normal; line-height: 1.4;
    bottom: 125%;
    left: 50%; transform: translateX(-50%);
    white-space: nowrap; z-index: 10000;
    opacity: 0; transition: opacity 0.2s ease-in-out, visibility 0.2s;
    visibility: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    min-width: 150px;
}
.tooltip-icon:hover .tooltip-content, .tooltip-icon:focus .tooltip-content, .tooltip-icon:focus-within .tooltip-content {
    display: block; opacity: 1; visibility: visible;
}

/* --- HEADER & NAVIGATION (NEW STYLE) --- */
header {
    background-color: var(--card-bg-light);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-radius: var(--container-border-radius) var(--container-border-radius) 0 0;
    z-index: 1001; /* Ensure header is above content */
}
body.dark-mode header {
    background-color: var(--card-bg-dark);
    border-bottom-color: var(--border-dark);
}
header h1 {
    font-size: clamp(1.2em, 3.5vw, 1.4em);
    font-weight: 700;
    margin: 0;
}
header h1 a {
    color: var(--text-light);
    text-decoration: none;
}
body.dark-mode header h1 a { color: var(--text-dark); }

nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
body.dark-mode .nav-link { color: var(--text-dark); }

.nav-link:hover, .nav-link:focus, .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
body.dark-mode .nav-link:hover, body.dark-mode .nav-link:focus, body.dark-mode .nav-link.active {
    color: var(--link-color);
    border-bottom-color: var(--link-color);
}

.nav-link.has-dropdown::after {
    content: 'expand_more';
    font-family: 'Material Icons Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    transition: transform 0.2s ease-in-out;
}
.nav-item:hover > .nav-link.has-dropdown::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg-light);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 0.5rem;
    z-index: 1000;
    min-width: 260px;
    border: 1px solid var(--border-light);
    max-height: 80vh;
    overflow-y: auto;
}
.nav-item:hover > .dropdown-menu {
    display: block;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--background-light);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: -8px;
    z-index: 1;
}
.dropdown-header:first-of-type {
    margin-top: 0;
    border-top: none;
}
.dropdown-menu ul {
    list-style: none;
    padding: 0;
}
.dropdown-menu li {
    padding: 0.25rem;
}
.dropdown-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}
.dropdown-item.active {
    background-color: var(--highlight-bg-light);
    color: var(--primary-color) !important;
    font-weight: 700;
}
.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--primary-color);
    color: white !important;
}

.dark-mode-btn {
    font-size: 1.4rem;
    line-height: 1;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 5px;
    color: var(--text-light);
    transition: transform 0.2s, color 0.2s;
    border-radius: 50%;
    flex-shrink: 0;
}
body.dark-mode .dark-mode-btn { color: var(--text-dark); }
.dark-mode-btn:hover, .dark-mode-btn:focus {
    transform: scale(1.1);
    color: var(--primary-color);
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1002;
}
.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
    width: 30px;
    height: 3px;
    background-color: var(--text-light);
    border-radius: 3px;
    position: absolute;
    transition: transform .25s ease-in-out;
}
body.dark-mode .hamburger-inner, body.dark-mode .hamburger-inner::before, body.dark-mode .hamburger-inner::after {
    background-color: var(--text-dark);
}
.hamburger-inner { top: 50%; transform: translateY(-50%); }
.hamburger-inner::before, .hamburger-inner::after { content: ''; display: block; }
.hamburger-inner::before { top: -10px; }
.hamburger-inner::after { bottom: -10px; }
.hamburger.active .hamburger-inner { transform: rotate(45deg); }
.hamburger.active .hamburger-inner::before { top: 0; transform: rotate(90deg); }
.hamburger.active .hamburger-inner::after { bottom: 0; transform: rotate(90deg); opacity: 0; }


@media (max-width: 920px) {
    .hamburger { display: block; }
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--surface-color);
        flex-direction: column;
        padding: 6rem 1rem 2rem;
        gap: 0.5rem;
        transition: right 0.4s ease-in-out;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        overflow-y: auto;
        align-items: flex-start;
    }
    .nav-menu.active {
        right: 0;
    }
    .nav-item {
        width: 100%;
    }
    .nav-link {
        display: flex;
        justify-content: space-between;
        width: 100%;
        padding: 1rem;
        border-bottom: none !important;
    }
    .nav-link.active {
        background-color: var(--highlight-bg-light);
    }
    .dropdown-menu {
        position: static;
        display: none; /* Hide by default on mobile */
        width: 100%;
        background: transparent;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
        margin-top: 0.5rem;
        transform: none;
        opacity: 1;
        max-height: none;
        overflow-y: visible;
    }
    .nav-item.open > .dropdown-menu {
        display: block; /* Show on click */
    }
    .dropdown-header {
        background: transparent;
        border: none;
        position: static;
        padding: 0.5rem 1rem;
    }
    .dropdown-item:hover, .dropdown-item:focus {
        background-color: var(--highlight-bg-light);
        color: var(--primary-color) !important;
    }
}

body.dark-mode .dropdown-menu {
    background-color: var(--card-bg-dark);
    border-color: var(--border-dark);
}
body.dark-mode .dropdown-header {
    background-color: #2c2c2e;
    border-color: var(--border-dark);
    color: #aaa;
}
body.dark-mode .dropdown-item {
    color: var(--text-dark);
}
body.dark-mode .dropdown-item.active {
    background-color: var(--highlight-bg-dark);
    color: var(--link-color) !important;
}
body.dark-mode .dropdown-item:hover, body.dark-mode .dropdown-item:focus {
    background-color: var(--primary-color);
    color: white !important;
}
body.dark-mode .nav-menu {
    background-color: var(--card-bg-dark);
}
body.dark-mode .nav-link.active {
    background-color: var(--highlight-bg-dark);
}

/* Main Structure & Spacing */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.box-calculators, .calculator-guide, .faq-section, .quick-tip, .article-container, .summary-container, .site-footer, .ports-info-container, .main-ip-card, .tools-section {
    background: var(--card-bg-light); border-radius: var(--container-border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); margin-bottom: var(--section-spacing);
    border: 1px solid var(--border-light);
}
.container > .box-calculators, .container > section, .container > main, .container > div {
    margin-top: var(--section-spacing);
}
.calculator-body, .ports-info-body { padding: 30px; }
.calculator-body h2, .ports-info-body h2 {
    margin-bottom: 25px; font-size: clamp(1.4em, 4vw, 1.6em); font-weight: 700; color: var(--primary-color);
    display: flex; align-items: center;
}
.calculator-body h2 .material-icons-outlined, .ports-info-body h2 .material-icons-outlined {
    font-size: 1.2em; margin-right: 0.3em;
}

/* Forms, Buttons, Results, etc. */
.form-group { margin-bottom: 20px; }
label { font-weight: 500; display: flex; align-items: center; margin-bottom: 8px; font-size: 0.95rem; }
.form-text { font-size: 0.9rem; color: #6c757d; margin-top: -10px; margin-bottom: 10px; }
input, select, textarea {
    width: 100%; padding: 12px 15px; border: 1px solid var(--border-light);
    border-radius: 6px; font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s, color 0.3s;
    background-color: var(--input-bg-light); color: var(--text-light);
}
input::placeholder { color: #6c757d; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color); outline: none;
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.2);
}

/* --- NEW: Input Validation Styles --- */
input.is-valid, select.is-valid {
    border-color: var(--success-color);
}
input.is-valid:focus, select.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}
input.is-invalid, select.is-invalid {
    border-color: var(--error-color);
}
input.is-invalid:focus, select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

.apple-like-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    background-color: var(--primary-color);
    color: var(--button-text);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    margin-top: 0;
    vertical-align: middle; /* ADDED THIS FOR BETTER ALIGNMENT */
}
.apple-like-btn:hover, .apple-like-btn:focus { background-color: var(--primary-color-dark); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.apple-like-btn:active { transform: scale(0.98); box-shadow: none; }
.btn-secondary { background-color: #6c757d; }
.btn-secondary:hover, .btn-secondary:focus { background-color: #5a6268; }
.btn-suggest { background-color: var(--info-color); }
.btn-suggest:hover, .btn-suggest:focus { background-color: #128293; }
.print-btn { background-color: var(--success-color); }
.print-btn:hover, .print-btn:focus { background-color: var(--success-color-dark); }
.btn-group-calc { margin-top: 15px; margin-bottom: 15px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-group-calc > .apple-like-btn { margin-top: 0; }

.results .btn-group-calc {
    margin-top: 20px;
    /* REMOVED justify-content: flex-end; to keep it aligned left by default */
}


/* NEW: Visual Feedback for Calculating Buttons */
.apple-like-btn.calculating {
    animation: pulse 0.8s infinite;
}
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(30, 136, 229, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(30, 136, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(30, 136, 229, 0);
    }
}
body.dark-mode .apple-like-btn.calculating {
    animation-name: pulse-dark;
}
@keyframes pulse-dark {
    0% {
        box-shadow: 0 0 0 0 rgba(100, 181, 246, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(100, 181, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(100, 181, 246, 0);
    }
}


.results {
    display: none; background: var(--card-bg-light);
    border-radius: 8px; padding: 25px; margin-top: 30px; border: 1px solid var(--border-light);
}
.results h3 {
    color: var(--primary-color); margin-bottom: 20px; font-size: 1.3em;
    border-bottom: 1px solid var(--border-light); padding-bottom: 10px;
}
.results h4 {
    color: var(--primary-color-dark);
    margin-bottom: 15px;
    font-size: 1.1em;
}
body.dark-mode .results h4 {
    color: var(--link-color);
}

.results table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.results th, .results td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-light);
    vertical-align: top; font-size: 0.95rem;
}
.results th { font-weight: 700; width: 35%; white-space: nowrap; }
.results td { word-break: break-all; font-family: var(--code-font-family); color: var(--primary-color-dark); }
.results tr:last-child th, .results tr:last-child td { border-bottom: none; }
.results tbody tr:nth-child(odd) { background-color: rgba(0,0,0,0.02); }

.results pre {
    background-color: var(--code-bg-light);
    padding: 15px;
    border-radius: 6px;
    white-space: pre-wrap;       /* Faz o texto quebrar a linha */
    word-wrap: break-word;       /* Força a quebra de palavras/strings longas */
    overflow-x: auto;            /* Adiciona barra de rolagem se necessário */
    font-size: 0.9em;
}

body.dark-mode .results pre {
    background-color: var(--code-bg-dark);
}


.explanation {
    display: none; background: var(--highlight-bg-light); border: 1px solid var(--highlight-border-light);
    border-radius: 8px; padding: 25px; margin-top: 30px;
    font-size: 0.95rem; line-height: 1.7;
}


.explanation h3 { color: var(--primary-color-dark); margin-bottom: 15px; }
.explanation p { margin-bottom: 1em; }
.explanation code { background-color: var(--code-bg-light); padding: 2px 5px; border-radius: 4px; font-family: var(--code-font-family); }
.summary-container { padding: 25px; }
.summary-container h3 { margin-bottom: 15px; color: var(--primary-color); font-size: 1.2em; }
.summary-container p { margin-bottom: 1em; line-height: 1.7; }

/* Article/Guide/FAQ Sections */
.article-container, .calculator-guide, .faq-section { padding: 30px 40px; }
.article-container h1, .calculator-guide h2, .faq-section h2 { font-size: clamp(1.5em, 4.5vw, 1.7em); color: var(--primary-color); margin-top: 0; margin-bottom: 25px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.article-container h2 { font-size: clamp(1.4em, 4vw, 1.6em); color: var(--primary-color-dark); margin-top: 1.8em; margin-bottom: 1em; }
.article-container h3, .calculator-guide h3 { font-size: clamp(1.2em, 3.5vw, 1.35em); color: var(--primary-color); margin-top: 1.5em; margin-bottom: 0.8em; }
.article-container p, .article-container li, .calculator-guide p, .calculator-guide li { margin-bottom: 1.2em; line-height: 1.75; font-size: 1rem; }
.article-container ul, .article-container ol, .calculator-guide ul { margin-bottom: 1.2em; padding-left: 25px; }
.article-container code { background-color: var(--code-bg-light); padding: 3px 6px; border-radius: 4px; font-family: var(--code-font-family); font-size: 0.9em; word-break: break-word; }
.article-container a { color: var(--link-color); text-decoration: none; font-weight: 500; }
.article-container a:hover, .article-container a:focus { text-decoration: underline; color: var(--primary-color-dark); }
.faq-section details { background-color: var(--highlight-bg-light); border: 1px solid var(--highlight-border-light); border-radius: 6px; margin-bottom: 1em; padding: 12px 18px; }
.faq-section summary { font-weight: 600; cursor: pointer; color: var(--primary-color); font-size: 1.1em; }
.faq-section details[open] summary { margin-bottom: 0.8em; }
.faq-section p { font-size: 0.98rem; margin-left: 10px; margin-top: 0.5em; line-height: 1.7;}

/* Other Components */
.info-box { padding: 20px; text-align: center; margin-top: var(--section-spacing); }
.info-box h2 { margin-bottom: 8px; font-weight: 500; font-size: 1.1em; }
.info-box p { margin-bottom: 0; color: #6c757d; font-size: 0.95em; }
.error {
    color: var(--error-color); margin-top: 15px; text-align: left;
    font-weight: 500; font-size: 0.9rem; padding: 10px;
    background-color: rgba(220, 53, 69, 0.1); border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 6px; display: none;
}
.error.show { display: block; }

/* --- NEW STYLES for HOMEPAGE & WHATS MY IP --- */
.main-ip-card { padding: 30px; }
.card-title { text-align: center; font-size: clamp(1.5em, 5vw, 2em); margin-bottom: 0.5rem; }
.ip-display-large { text-align: center; font-size: clamp(1.8em, 6vw, 2.5em); font-weight: 700; color: var(--primary-color); margin-bottom: 2rem; font-family: var(--code-font-family); }
.ip-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.info-sheet { background-color: var(--background-light); padding: 15px; border-radius: var(--container-border-radius); }
body.dark-mode .info-sheet { background-color: #2c2c2e; }
.info-sheet-header { display: flex; align-items: center; gap: 15px; }
.info-sheet-icon { font-size: 1.8rem; color: var(--primary-color); }
.info-sheet-label { font-size: 0.9rem; color: #6c757d; }
.info-sheet-value { font-weight: 500; }
#location-map { height: 300px; border-radius: var(--container-border-radius); z-index: 1; }
.tools-section { padding: 30px; }
.section-title { text-align: center; font-size: 2rem; margin-bottom: 2rem; }
.tool-category-title { font-size: 1.5rem; color: var(--primary-color); margin-top: 2rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--primary-color); padding-bottom: 0.5rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.tool-card {
    display: flex; flex-direction: column; text-align: left; padding: 20px;
    background-color: var(--card-bg-light); border-radius: var(--container-border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07); transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none; color: var(--text-light); border: 1px solid var(--border-light);
}
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
body.dark-mode .tool-card { background-color: var(--card-bg-dark); color: var(--text-dark); border-color: var(--border-dark); } /* DARK MODE FIX */
.tool-card.coming-soon { opacity: 0.6; pointer-events: none; }
.tool-icon { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 1rem; }
.tool-card h4 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--text-light); }
body.dark-mode .tool-card h4 { color: var(--text-dark); }
.tool-card p { font-size: 0.95rem; color: #6c757d; margin-bottom: 0; flex-grow: 1; }
body.dark-mode .tool-card p { color: #aaa; }


/* --- STYLES for VLSM --- */
.vlsm-result-card { border: 1px solid var(--border-light); border-left: 5px solid var(--primary-color); padding: 1.5rem; border-radius: var(--container-border-radius); transition: box-shadow 0.2s; }
.vlsm-result-card:hover, .vlsm-result-card:focus-within { box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.vlsm-result-card h4 { margin-top: 0; margin-bottom: 1rem; color: var(--primary-color); }
.vlsm-result-card h4 small { font-size: 0.8em; color: #6c757d; }
.vlsm-result-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; font-size: 0.9rem; }
.vlsm-result-card dt { font-weight: 500; color: #6c757d; }
.vlsm-result-card dd { font-family: var(--code-font-family); word-break: break-all; font-weight: 700; }
body.dark-mode .vlsm-result-card { border-color: var(--border-dark); border-left-color: var(--link-color); }
body.dark-mode .vlsm-result-card h4 { color: var(--link-color); }
body.dark-mode .vlsm-result-card h4 small { color: #aaa; }
body.dark-mode .vlsm-result-card dt { color: #aaa; }

/* Ports Tool Specific */
#ports-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#ports-table { width: 100%; min-width: 600px; border-collapse: collapse; margin-top: 20px; font-size: 0.9rem; }
#ports-table th, #ports-table td { border: 1px solid var(--border-light); padding: 8px 10px; text-align: left; vertical-align: middle; }
#ports-table th { background-color: var(--highlight-bg-light); font-weight: 600; white-space: nowrap;}
.port-protocol-tcp { color: var(--success-color); }
.port-protocol-udp { color: var(--info-color); }
.port-protocol-tcp-udp { color: var(--primary-color); font-weight: 500; }

/* Modals & Footer */
.modal {
    display: none; /* Changed from none to flex by JS */
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-out, visibility 0.3s;
    visibility: hidden;
}
.modal.show {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background-color: var(--card-bg-light); margin: 2rem auto; padding: 0;
    border-radius: var(--container-border-radius);
    width: 90%; max-width: 750px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative; 
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal.show .modal-content {
    transform: scale(1);
}
.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
}
.modal-header h2 { margin-top: 0; margin-bottom: 0; color: var(--primary-color); font-size: 1.5em; }

.modal-close {
    color: #aaa; float: right; font-size: 28px; font-weight: bold;
    line-height: 1; cursor: pointer; transition: color 0.2s;
    border: none; background: transparent; padding: 0;
}
.modal-close:hover, .modal-close:focus { color: var(--text-light); text-decoration: none; }
.modal-content h3 { font-size: 1.1em; color: var(--primary-color-dark); margin-top: 1.2em; margin-bottom: 0.6em; }
.modal-content p { margin-bottom: 1em; line-height: 1.7; font-size: 0.95rem; }
.modal-content ul { margin-left: 20px; margin-bottom: 1em; padding-left: 15px;}

.site-footer {
    padding: 30px 20px; 
    border-top: 1px solid var(--border-light);
}
.footer-links-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto 30px auto;
    text-align: left;
}
.footer-column h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary-color);
}
.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-column li {
    margin-bottom: 10px;
}
.footer-column ul li a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.9rem;
}
.footer-column ul li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}
.footer-bottom {
    text-align: center;
    font-size: 0.9em;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.footer-bottom p { margin-bottom: 8px;}
.footer-bottom a { color: var(--link-color); text-decoration: none; margin: 0 10px; }
.footer-bottom a:hover, .footer-bottom a:focus { text-decoration: underline; color: var(--primary-color-dark); }

/* ====== Dark Mode Overrides ====== */
body.dark-mode .box-calculators, body.dark-mode .main-ip-card, body.dark-mode .tools-section, body.dark-mode .calculator-guide, body.dark-mode .faq-section, body.dark-mode .article-container, body.dark-mode .summary-container, body.dark-mode .ports-info-container, body.dark-mode .site-footer { background: var(--card-bg-dark); border-color: var(--border-dark); }
body.dark-mode .calculator-body h2, body.dark-mode .ports-info-body h2, body.dark-mode .calculator-guide h2, body.dark-mode .faq-section h2, body.dark-mode .article-container h1, body.dark-mode .modal-header h2, body.dark-mode .results h3 { color: var(--link-color); }
body.dark-mode .faq-section h2, body.dark-mode .article-container h2, body.dark-mode .results h3, body.dark-mode .modal-header, body.dark-mode .footer-bottom { border-bottom-color: var(--border-dark); border-top-color: var(--border-dark); }
body.dark-mode input, body.dark-mode select { background-color: var(--input-bg-dark); color: var(--text-dark); border-color: var(--border-dark); }
body.dark-mode input:focus, body.dark-mode select:focus { border-color: var(--link-color); box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.25); }
body.dark-mode .apple-like-btn { background-color: var(--link-color); color: #1c1c1e; }
body.dark-mode .apple-like-btn:hover, body.dark-mode .apple-like-btn:focus { background-color: #90caf9; }
body.dark-mode .btn-secondary { background-color: #555; }
body.dark-mode .btn-secondary:hover, body.dark-mode .btn-secondary:focus { background-color: #666; }
body.dark-mode .print-btn { background: var(--success-color-dark); }
body.dark-mode .print-btn:hover, body.dark-mode .print-btn:focus { background: #2e8b57; }
body.dark-mode .results { background: var(--card-bg-dark); color: var(--text-dark); border-color: var(--border-dark); }
body.dark-mode .results th, body.dark-mode .results td { border-bottom-color: var(--border-dark); }
body.dark-mode .results td { color: var(--link-color); }
body.dark-mode .results tbody tr:nth-child(odd) { background-color: rgba(255,255,255,0.04); }
body.dark-mode .explanation { background: var(--highlight-bg-dark); border-color: var(--highlight-border-dark); }
body.dark-mode .explanation h3, body.dark-mode .calculator-guide h3 { color: #a6d4fa; }
body.dark-mode .explanation code, body.dark-mode .summary-container code, body.dark-mode .article-container code { background-color: var(--code-bg-dark); }
body.dark-mode .faq-section details { background-color: var(--highlight-bg-dark); border-color: var(--highlight-border-dark); }
body.dark-mode .faq-section summary { color: #a6d4fa; }
body.dark-mode .error { color: #f8d7da; background-color: rgba(248, 215, 218, 0.1); border-color: rgba(248, 215, 218, 0.2); }
body.dark-mode .modal-content { background-color: var(--card-bg-dark); border-color: var(--border-dark); }
body.dark-mode .modal-close:hover, .modal-close:focus { color: var(--text-dark); }
body.dark-mode .footer-column h4 { color: var(--link-color); }
body.dark-mode .footer-column ul li a { color: var(--text-dark); }
body.dark-mode .footer-column ul li a:hover { color: var(--link-color); }
body.dark-mode .site-footer a { color: var(--link-color); }
body.dark-mode .site-footer a:hover, .site-footer a:focus { color: #90caf9; }
body.dark-mode #ports-table th { background-color: var(--highlight-bg-dark); }
body.dark-mode #ports-table td, body.dark-mode #ports-table th { border-color: var(--border-dark); }
body.dark-mode #ports-table tbody tr:nth-child(odd) { background-color: rgba(255,255,255,0.04); }
body.dark-mode .port-protocol-tcp { color: #81c784; }
body.dark-mode .port-protocol-udp { color: #64b5f6; }
body.dark-mode .port-protocol-tcp-udp { color: #90caf9; }

@media print {
    body { background: #fff !important; color: #000 !important; font-size: 10pt; }
    header, nav, .hamburger, .dark-mode-btn, .recent-calc-container, .summary-container, .info-box, .explanation, button, .tooltip-icon, .site-footer, .modal { display: none !important; }
    .container { max-width: 100%; margin: 0; padding: 10px; }
    .box-calculators, .results { border: none !important; box-shadow: none !important; }
    .calculator-body h2 { font-size: 14pt; color: #000; }
    .results { display: block !important; margin-top: 20px; border-top: 1px solid #ccc; background: none !important; padding: 0 !important;}
    .results h3 { font-size: 12pt; color: #000;}
    .results-table-container { overflow: visible !important; }
    .results table { font-size: 9pt; }
    .results th, .results td { border: 1px solid #ccc !important; color: #000 !important; white-space: normal !important; }
    .results th { background-color: #eee !important; }
    .results td { font-family: var(--code-font-family); }
    .error { border: 1px solid #000 !important; color: #000 !important; background: #eee !important; display: block !important;}
}

/* --- Styles for Map Containers on Tool Pages --- */
.location-map-container {
    height: 300px;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: var(--container-border-radius);
    display: none; /* Hidden by default, shown by JS */
    z-index: 1; /* Ensures map tiles are rendered correctly */
    border: 1px solid var(--border-light);
}

body.dark-mode .location-map-container {
    border-color: var(--border-dark);
}

/* Red Danger Button Style */
.btn-danger {
    background-color: var(--error-color);
}
.btn-danger:hover, .btn-danger:focus {
    background-color: var(--error-color-dark);
}
body.dark-mode .btn-danger {
    background-color: var(--error-color-dark);
}
body.dark-mode .btn-danger:hover, .btn-danger:focus {
    background-color: var(--error-color);
}


/* --- Recent Calculations Modal --- */
.recent-calc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10002;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}
.recent-calc-modal.show {
    opacity: 1;
}
.recent-calc-modal-content {
    background-color: var(--card-bg-light);
    color: var(--text-light);
    border-radius: var(--container-border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}
.recent-calc-modal.show .recent-calc-modal-content {
    transform: scale(1);
}
body.dark-mode .recent-calc-modal-content {
    background-color: var(--card-bg-dark);
    color: var(--text-dark);
}
.recent-calc-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
body.dark-mode .recent-calc-modal-header {
    border-bottom-color: var(--border-dark);
}
.recent-calc-modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: var(--primary-color);
}
body.dark-mode .recent-calc-modal-header h2 {
    color: var(--link-color);
}
.modal-close-btn {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}
.modal-close-btn:hover {
    color: var(--error-color);
}
.recent-calc-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}
.recent-calc-modal-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.recent-calc-modal-body li {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: var(--code-font-family);
    font-size: 0.95rem;
    border: 1px solid var(--border-light);
}
.recent-calc-modal-body li:last-child {
    margin-bottom: 0;
}
.recent-calc-modal-body li:hover,
.recent-calc-modal-body li:focus {
    background-color: var(--highlight-bg-light);
    border-color: var(--highlight-border-light);
    color: var(--primary-color);
}
body.dark-mode .recent-calc-modal-body li {
    border-color: var(--border-dark);
}
body.dark-mode .recent-calc-modal-body li:hover,
body.dark-mode .recent-calc-modal-body li:focus {
    background-color: var(--highlight-bg-dark);
    border-color: var(--highlight-border-dark);
    color: var(--link-color);
}
.recent-calc-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-light);
    text-align: right;
    flex-shrink: 0;
}
body.dark-mode .recent-calc-modal-footer {
    border-top-color: var(--border-dark);
}
.recent-calc-modal-footer .apple-like-btn {
    margin-top: 0;
}

/* --- ACL Generator Modern Layout --- */
.acl-config-column, .acl-result-column { display: flex; flex-direction: column; gap: 20px; }
.acl-result-column { margin-top: 30px; }
.acl-card { background-color: var(--background-light); border: 1px solid var(--border-light); border-radius: var(--container-border-radius); overflow: hidden; }
.acl-card-header { padding: 15px 20px; border-bottom: 1px solid var(--border-light); }
.acl-card-header h4 { margin-bottom: 4px; color: var(--primary-color); }
.acl-card-header p { font-size: 0.9rem; color: #6c757d; margin: 0; }
.acl-card-body { padding: 20px; }
.acl-card-body h5 { font-size: 1rem; font-weight: 500; margin-top: 1rem; margin-bottom: 0.8rem; }
.acl-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.acl-divider { border: none; border-top: 1px solid var(--border-light); margin: 1.5rem 0; }
#results-acl { margin-top: 0; display: flex; flex-direction: column; }
#results-acl pre { background-color: var(--code-bg-light); padding: 15px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; flex-grow: 1; font-size: 0.9em; min-height: 100px; }
#results-acl button#copy-acl-btn { margin-top: 1rem; width: 100%; }
body.dark-mode .acl-card { background-color: var(--card-bg-dark); border-color: var(--border-dark); }
body.dark-mode .acl-card-header { border-bottom-color: var(--border-dark); }
body.dark-mode .acl-card-header h4 { color: var(--link-color); }
body.dark-mode .acl-card-header p { color: #aaa; }
body.dark-mode .acl-divider { border-top-color: var(--border-dark); }
body.dark-mode #results-acl pre { background-color: var(--code-bg-dark); }
@media (max-width: 600px) {
    .acl-input-grid, .ip-group, .port-group, .acl-type-group { grid-template-columns: 1fr; display: block; }
    .acl-input-grid .form-group:not(:last-child) { margin-bottom: 20px; }
    .ip-group input:not(:last-child), .port-group select, .acl-type-group select { margin-bottom: 10px; }
}

/* --- Network Planner (V2) Layout - ENHANCED --- */
.apple-like-btn span {
    margin-left: 0.25em;
}
.apple-like-btn .material-icons-outlined + span {
    margin-left: 0.5em;
}

.planner-config-column { display: flex; flex-direction: column; gap: 20px; }
.planner-results-column { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 40px; }

.planner-card-v2 {
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--container-border-radius);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.planner-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-light);
}
.planner-card-header h3 {
    margin: 0 0 4px 0;
    color: var(--primary-color);
    font-size: 1.3em;
}
.planner-card-header h4 {
    margin-bottom: 4px;
    color: var(--primary-color-dark);
}
.planner-card-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}
.planner-card-body { padding: 20px; }
.planner-card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-light);
    background-color: rgba(0,0,0,0.02);
    text-align: right;
}
#sites-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Site Card Styling - ENHANCED */
.planner-site-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background-color: var(--card-bg-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    animation: fadeIn 0.5s ease-out;
    overflow: hidden; /* To contain header background */
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.planner-site-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border-light);
    background-color: #f8f9fa; /* Lighter grey for better contrast */
}
.site-title {
    font-weight: 600; /* Bolder title */
    font-size: 1.1em;
    color: var(--primary-color-dark);
}
.planner-site-header .site-name {
    flex-grow: 1;
    font-weight: 500;
    font-size: 1.1em;
    padding: 8px 10px; /* More defined input area */
    border: 1px solid transparent;
    border-radius: 6px;
    transition: border-color 0.2s, background-color 0.2s;
}
.planner-site-header .site-name:focus {
    border-color: var(--primary-color);
    background-color: var(--card-bg-light);
}


/* Remove Buttons (Desktop Text / Mobile Icon) */
.remove-site-btn, .remove-subnet-btn {
    background-color: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}
.remove-site-btn:hover, .remove-subnet-btn:hover {
    background-color: var(--error-color);
    color: white;
}
.remove-btn-icon { display: none; }

@media (max-width: 768px) {
    .remove-btn-text { display: none; }
    .remove-btn-icon { display: inline; font-size: 1.5em; line-height: 1; }
    .remove-site-btn, .remove-subnet-btn {
        padding: 0;
        width: 36px;
        height: 36px;
        border-radius: 50%;
    }
}


.planner-site-body { padding: 20px; }
.subnets-container-header {
    display: flex;
    justify-content: space-between;
    padding: 0 10px 5px 10px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 10px;
    font-size: 0.9em;
    font-weight: 500;
    color: #6c757d;
}
.subnets-container-header span:last-child {
    padding-right: 46px; /* Align with hosts input */
}
.subnets-container { display: flex; flex-direction: column; gap: 10px; }
.planner-subnet-entry { display: flex; align-items: center; gap: 10px; }
.planner-subnet-entry .subnet-name { flex-grow: 1; }
.planner-subnet-entry .subnet-hosts { max-width: 120px; }
.add-subnet-btn {
    margin-top: 15px;
    padding: 8px 12px;
    font-size: 0.9rem;
}
.add-subnet-btn .material-icons-outlined { font-size: 1.1em; vertical-align: text-bottom; margin-right: 4px; }

.planner-site-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 0.95em;
    text-align: right;
    background-color: #f8f9fa; /* Match header */
    font-weight: 500;
}

/* Summary Box */
.planner-summary-box {
    background-color: var(--highlight-bg-light);
    border: 1px solid var(--highlight-border-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.planner-summary-box h4 { margin: 0 0 10px 0; color: var(--primary-color); }
.planner-summary-box p { margin: 0 0 5px 0; font-size: 0.95rem; }
.planner-summary-box strong { font-family: var(--code-font-family); }


/* Results Styling - ENHANCED */
.planner-results-column .planner-card-header h3 { font-size: 1.6em; }
.planner-results-column .planner-card-header h4 { font-size: 1.2em; color: var(--primary-color-dark); }
.planner-results-column .results-table { font-size: 0.9rem; }
.planner-results-column .results-table thead th {
    background-color: var(--background-light);
    white-space: nowrap;
}
.planner-results-column .results-table td, 
.planner-results-column .results-table th { padding: 10px 12px; }
.results-table .subnet-name-clickable {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.results-table .subnet-name-clickable:hover {
    color: var(--primary-color-dark);
    text-decoration: underline;
}

/* Saved Plans List */
.saved-plans-container {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--container-border-radius);
    background-color: var(--background-light);
}
.saved-plans-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.saved-plans-container li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-radius: 6px;
    background-color: var(--card-bg-light);
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s;
    flex-wrap: wrap;
    gap: 10px;
}
.saved-plans-container li:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.plan-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.plan-name {
    font-weight: 500;
    font-size: 1.05em;
}
.plan-block {
    font-family: var(--code-font-family);
    color: #6c757d;
    font-size: 0.9em;
}
.plan-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.plan-actions .apple-like-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    margin-top: 0;
}

/* Dark Mode Overrides for V2 - ENHANCED */
body.dark-mode .planner-card-v2, body.dark-mode .planner-site-card { background-color: var(--card-bg-dark); border-color: var(--border-dark); }
body.dark-mode .planner-card-header, body.dark-mode .planner-card-footer { border-color: var(--border-dark); background-color: rgba(255,255,255,0.04); }
body.dark-mode .planner-site-header, body.dark-mode .planner-site-footer { background-color: #3a3a3c; border-color: var(--border-dark); } /* Darker contrast header */
body.dark-mode .planner-card-header h3, body.dark-mode .planner-summary-box h4, body.dark-mode .site-title, body.dark-mode .planner-card-header h4 { color: var(--link-color); }
body.dark-mode .planner-card-header p, body.dark-mode .form-text, body.dark-mode .subnets-container-header { color: #aaa; }
body.dark-mode .planner-site-header .site-name { color: var(--text-dark); background-color: transparent; }
body.dark-mode .planner-site-header .site-name:focus { background-color: var(--card-bg-dark); }
body.dark-mode .planner-summary-box { background-color: var(--highlight-bg-dark); border-color: var(--highlight-border-dark); }
body.dark-mode .remove-site-btn, body.dark-mode .remove-subnet-btn { color: var(--error-color-dark); border-color: var(--error-color-dark); }
body.dark-mode .remove-site-btn:hover, body.dark-mode .remove-subnet-btn:hover { background-color: var(--error-color-dark); color: white; }
body.dark-mode .planner-results-column .planner-card-header h4 { color: #a6d4fa; }
body.dark-mode .planner-results-column .results-table thead th { background-color: #3a3a3c; }
body.dark-mode .results-table .subnet-name-clickable {
    color: var(--link-color);
}
body.dark-mode .results-table .subnet-name-clickable:hover {
    color: #90caf9;
}
body.dark-mode .results-table .subnet-row:hover {
    background-color: var(--highlight-bg-dark) !important;
}

body.dark-mode .saved-plans-container {
    background-color: var(--card-bg-dark);
    border-color: var(--border-dark);
}
body.dark-mode .saved-plans-container ul li {
    background-color: #3a3a3c;
    border-color: var(--border-dark);
}
body.dark-mode .plan-block {
    color: #aaa;
}

/* --- Network Planner Modal Styling (v4 - FINAL) --- */
#subnetDetailModal .modal-content {
    max-width: 600px;
    border-radius: 12px;
}
#subnetDetailModal .modal-header {
    padding: 16px 24px;
}
#subnetDetailModal .modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}
#subnetDetailModal .modal-body {
    padding: 0 24px 24px 24px;
}
#subnetDetailModal .modal-details-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
#subnetDetailModal .modal-details-list dt,
#subnetDetailModal .modal-details-list dd {
    padding: 12px 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-light);
}
#subnetDetailModal .modal-details-list > dt:last-of-type,
#subnetDetailModal .modal-details-list > dd:last-of-type {
    border-bottom: none;
}
#subnetDetailModal .modal-details-list dt {
    font-weight: 500;
    color: #6c757d;
    background-color: var(--background-light);
}
#subnetDetailModal .modal-details-list dd {
    font-weight: 500;
    font-family: var(--code-font-family);
    text-align: right;
    word-break: break-all;
}
#subnetDetailModal .modal-details-list dd code {
    font-family: inherit;
    font-size: inherit;
}

/* Dark Mode Modal Styles (v4) */
body.dark-mode #subnetDetailModal .modal-body {
    background-color: var(--card-bg-dark);
}
body.dark-mode #subnetDetailModal .modal-details-list {
    border-color: var(--border-dark);
}
body.dark-mode #subnetDetailModal .modal-details-list dt,
body.dark-mode #subnetDetailModal .modal-details-list dd {
    border-bottom-color: var(--border-dark);
}
body.dark-mode #subnetDetailModal .modal-details-list dt {
    color: #aaa;
    background-color: var(--background-dark);
}
body.dark-mode #subnetDetailModal .modal-details-list dd {
    color: var(--text-dark);
}
/* --- CIDR Calculator (Bitcricket Style) --- */
.cidr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

#results-cidr-subnets .results-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 6px;
}

body.dark-mode #results-cidr-subnets .results-table-container {
    border-color: var(--border-dark);
}

#results-cidr-subnets .results-table {
    margin-bottom: 0;
}

#results-cidr-subnets .results-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

#results-cidr-subnets .results-table thead th {
    background-color: var(--highlight-bg-light);
}

body.dark-mode #results-cidr-subnets .results-table thead th {
    background-color: var(--highlight-bg-dark);
}

#cidr-bit-usage {
    font-size: 1.1em;
    letter-spacing: 1.5px;
    background-color: var(--code-bg-light);
    padding: 10px 15px;
    border-radius: 6px;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

body.dark-mode #cidr-bit-usage {
    background-color: var(--code-bg-dark);
}
/* --- IPv4 Calculator Enhancements (Mode Switch, Presets) --- */
.calc-mode-selector {
    display: flex;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.mode-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background-color: var(--card-bg-light);
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.mode-btn:not(:last-child) {
    border-right: 1px solid var(--border-light);
}

.mode-btn.active {
    background-color: var(--primary-color);
    color: var(--button-text);
}

.mode-btn:hover:not(.active) {
    background-color: var(--highlight-bg-light);
}

.preset-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: var(--highlight-bg-light);
    color: var(--primary-color-dark);
    border: 1px solid var(--highlight-border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.preset-btn:hover {
    background-color: var(--highlight-border-light);
}


.results-options {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px;
    margin-bottom: -15px; /* Pull it closer to the results table */
    margin-top: 15px;
}

.results-mode-label {
    font-weight: 500;
    font-size: 0.95rem;
    margin-right: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#results-mode-switch, #results-mode-switch-ipv6 {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

#results-mode-switch:checked::before, #results-mode-switch-ipv6:checked::before {
    content: '✔';
    font-size: 14px;
    color: var(--primary-color);
    position: absolute;
    top: -2px;
    left: 1px;
}

/* Dark Mode Styles */
body.dark-mode .calc-mode-selector { border-color: var(--border-dark); }
body.dark-mode .mode-btn { background-color: var(--card-bg-dark); color: var(--text-dark); }
body.dark-mode .mode-btn:not(:last-child) { border-right-color: var(--border-dark); }
body.dark-mode .mode-btn.active { background-color: var(--link-color); color: var(--background-dark); }
body.dark-mode .mode-btn:hover:not(.active) { background-color: var(--highlight-bg-dark); }
body.dark-mode .preset-btn { background-color: var(--highlight-bg-dark); color: var(--link-color); border-color: var(--highlight-border-dark); }
body.dark-mode .preset-btn:hover { background-color: var(--border-dark); }
body.dark-mode #results-mode-switch, body.dark-mode #results-mode-switch-ipv6 { border-color: var(--link-color); }
body.dark-mode #results-mode-switch:checked::before, body.dark-mode #results-mode-switch-ipv6:checked::before { color: var(--link-color); }
/* --- IP Range Visualizer --- */
.ip-range-visualizer {
    margin-top: 20px;
    margin-bottom: 30px;
}
.ip-range-visualizer h3 {
    font-size: 1.1em;
    color: var(--primary-color-dark);
    margin-bottom: 10px;
    text-align: center;
}
body.dark-mode .ip-range-visualizer h3 {
    color: var(--link-color);
}
.visualizer-bar {
    display: flex;
    width: 100%;
    height: 30px;
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--border-light);
    border: 1px solid var(--border-dark);
}
body.dark-mode .visualizer-bar {
    border-color: var(--border-light);
}
.range-segment {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    transition: filter 0.2s;
    min-width: 1px; /* Ensure even tiny segments are visible */
}
.range-segment:hover {
    filter: brightness(1.15);
}
.range-segment.network {
    background-color: #dc3545; /* Red */
}
.range-segment.usable {
    background-color: #28a745; /* Green */
}
.range-segment.broadcast {
    background-color: #1e88e5; /* Blue */
}
.segment-tooltip {
    visibility: hidden;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    line-height: 1.4;
    pointer-events: none;
}
.segment-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.range-segment:hover .segment-tooltip {
    visibility: visible;
    opacity: 1;
}

/* --- Styles for NEW Guide Pages --- */
.comparison-table {
    font-size: 0.95rem;
}
.comparison-table th, .comparison-table td {
    padding: 12px 15px;
}
.comparison-table td:first-child {
    font-family: var(--code-font-family);
}
.wiring-diagram-container {
    max-width: 600px;
    margin: 1.5rem auto;
}
.cable-length-calculator #length-result {
    border: 1px solid var(--highlight-border-light);
    background-color: var(--highlight-bg-light);
}
.cable-length-calculator #length-result h4 {
    color: var(--primary-color-dark);
    margin: 0;
}
.cable-length-calculator #length-result p {
    color: var(--text-light);
}
body.dark-mode .cable-length-calculator #length-result {
    border-color: var(--highlight-border-dark);
    background-color: var(--highlight-bg-dark);
}
body.dark-mode .cable-length-calculator #length-result h4 {
    color: var(--link-color);
}
body.dark-mode .cable-length-calculator #length-result p {
    color: var(--text-dark);
}

/* --- Wi-Fi Guide Styles --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--border-light);
    outline: none;
    border-radius: 4px;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}
body.dark-mode input[type="range"] {
    background: var(--border-dark);
}
body.dark-mode input[type="range"]::-webkit-slider-thumb {
    background: var(--link-color);
}

.obstacle-selector {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}
.obstacle-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: var(--highlight-bg-light);
    color: var(--primary-color-dark);
    border: 1px solid var(--highlight-border-light);
    border-radius: 6px;
    cursor: pointer;
}
body.dark-mode .obstacle-btn {
    background-color: var(--highlight-bg-dark);
    color: var(--link-color);
    border-color: var(--highlight-border-dark);
}
.obstacle-btn:hover { background-color: var(--highlight-border-light); }
body.dark-mode .obstacle-btn:hover { background-color: var(--border-dark); }

.signal-strength-visualizer { 
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}
.signal-strength-visualizer .material-icons-outlined {
    font-size: 2.5rem;
    color: var(--primary-color);
}
.signal-info {
    flex-grow: 1;
    text-align: left;
}
.signal-info > strong, .speed-status > strong {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
    text-align: left;
}
.signal-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    width: 40px;
}
.signal-bar {
    width: 20%;
    background-color: var(--border-light);
    transition: background-color 0.3s, height 0.3s;
    border-radius: 2px 2px 0 0;
}
body.dark-mode .signal-bar { background-color: var(--border-dark); }
.signal-bar.active { background-color: var(--success-color); }
body.dark-mode .signal-bar.active { background-color: #81c784; }
.signal-bar.bar-1 { height: 20%; }
.signal-bar.bar-2 { height: 40%; }
.signal-bar.bar-3 { height: 60%; }
.signal-bar.bar-4 { height: 80%; }
.signal-bar.bar-5 { height: 100%; }

.signal-status {
    font-size: 0.9rem;
    margin-top: 4px;
    text-align: left;
}
.signal-status strong {
    display: inline;
}
.signal-status span {
    color: #6c757d;
    margin-left: 5px;
}
body.dark-mode .signal-status span {
    color: #aaa;
}

.speed-estimate-visualizer { 
    margin-top: 1rem;
}
.speed-status {
    text-align: left;
}
.speed-display {
    display: flex;
    align-items: center;
    gap: 10px;
}
.speed-display .material-icons-outlined {
    font-size: 2.5rem;
    color: var(--primary-color);
}
.speed-value {
    font-size: 1.5em;
    font-weight: 700;
    font-family: var(--code-font-family);
    color: var(--primary-color-dark);
}
body.dark-mode .speed-value {
    color: var(--link-color);
}

.total-speed-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
}
body.dark-mode .total-speed-container {
    border-top-color: var(--border-dark);
}
.total-speed-container h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.3em;
}
.total-speed-container p {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
}
body.dark-mode .total-speed-container p {
    color: #aaa;
}

.obstacle-list-container {
    list-style: none;
    padding: 0;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.obstacle-list-container li.obstacle-tag {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--highlight-bg-light);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--highlight-border-light);
    font-size: 0.9rem;
}
body.dark-mode .obstacle-list-container li.obstacle-tag {
    background-color: var(--highlight-bg-dark);
    border-color: var(--highlight-border-dark);
}

.obstacle-list-container li.no-obstacles {
    color: #6c757d;
    background: none;
    border: none;
    justify-content: flex-start;
    padding-left: 0;
    width: 100%;
}

.remove-obstacle-btn {
    background: none;
    border: none;
    color: var(--error-color);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 5px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: stretch; /* This makes cards in the same row equal height */
}
.wifi-band-result-card {
    border: 1px solid var(--border-light);
    border-radius: var(--container-border-radius);
    padding: 20px;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.wifi-band-result-card:hover:not(.disabled) {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
body.dark-mode .wifi-band-result-card:hover:not(.disabled) {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.wifi-band-result-card.disabled {
    opacity: 0.6;
    background-color: var(--background-light);
    cursor: not-allowed;
    justify-content: center;
}
.wifi-band-result-card .card-content-wrapper {
    flex-grow: 1;
}

body.dark-mode .wifi-band-result-card {
    border-color: var(--border-dark);
    background-color: var(--background-dark);
}
body.dark-mode .wifi-band-result-card.disabled {
    background-color: #252527;
}
.wifi-band-result-card h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.2em;
    text-align: center;
    color: var(--primary-color-dark);
}
body.dark-mode .wifi-band-result-card h4 {
    color: var(--link-color);
}
.channel-visualizer-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 1rem auto;
}
.channel-graph {
    position: relative;
    height: 150px;
    background-color: var(--background-light);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
body.dark-mode .channel-graph {
    background-color: var(--card-bg-dark);
    border-color: var(--border-dark);
}
.channel-shape {
    position: absolute;
    bottom: 0;
    width: 120px;
    height: 100%;
    background-color: rgba(30, 136, 229, 0.3);
    border: 2px solid rgba(30, 136, 229, 0.7);
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0% 100%);
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}
.channel-shape.active {
    opacity: 1;
}
.channel-controls {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
}
.channel-btn {
    padding: 6px 10px;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background-color: var(--card-bg-light);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
body.dark-mode .channel-btn {
    background-color: var(--card-bg-dark);
    border-color: var(--border-dark);
}
.channel-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
body.dark-mode .channel-btn.active {
    background-color: var(--link-color);
    color: var(--background-dark);
    border-color: var(--link-color);
}
.channel-btn.recommended {
    font-weight: bold;
}
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background-color: var(--background-light);
    padding: 15px;
    border-radius: 6px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin: 0;
}
.checkbox-group input[type="checkbox"] {
    width: auto;
}
body.dark-mode .checkbox-group {
    background-color: var(--card-bg-dark);
}
#subnetDetailModal .modal-details-list.sub-table {
    margin-top: 1rem;
}
#subnetDetailModal .modal-details-list.sub-table dt {
    text-align: right;
    background-color: transparent;
    font-weight: normal;
}
body.dark-mode #subnetDetailModal .modal-details-list.sub-table dt {
    background-color: transparent;
}


/* --- NEW GLOBAL STYLES for Tables, Callouts, etc. --- */

/* ==========================================================================
   CALLOUT BOXES (Alerts/Notes)
   ========================================================================== */
.callout-box {
    margin: 1.5em 0;
    padding: 20px;
    border-radius: var(--container-border-radius);
    border-left-width: 5px;
    border-left-style: solid;
}
.callout-box p:last-child {
    margin-bottom: 0;
}
.callout-box .callout-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    margin-bottom: 0.5em;
    font-size: 1.1em;
}
.callout-box .callout-title .material-icons-outlined {
    margin-right: 0.5em;
    vertical-align: middle;
}

/* Callout Box - INFO */
.callout-box.info {
    background-color: #e7f3fe;
    border-left-color: var(--info-color);
    color: #0c5460;
}
.callout-box.info .callout-title { color: #0c5460; }
body.dark-mode .callout-box.info {
    background-color: #233f50;
    border-left-color: var(--info-color);
    color: #a6d4fa;
}
body.dark-mode .callout-box.info .callout-title { color: #a6d4fa; }

/* Callout Box - SUCCESS / TIP */
.callout-box.success {
    background-color: #d1e7dd;
    border-left-color: var(--success-color);
    color: #0f5132;
}
.callout-box.success .callout-title { color: #0f5132; }
body.dark-mode .callout-box.success {
    background-color: #1c3c2e;
    border-left-color: var(--success-color-dark);
    color: #a3d9b8;
}
body.dark-mode .callout-box.success .callout-title { color: #a3d9b8; }

/* Callout Box - WARNING */
.callout-box.warning {
    background-color: #fff3cd;
    border-left-color: var(--warning-color);
    color: #856404;
}
.callout-box.warning .callout-title { color: #856404; }
body.dark-mode .callout-box.warning {
    background-color: #4d3c11;
    border-left-color: var(--warning-color);
    color: #ffd76a;
}
body.dark-mode .callout-box.warning .callout-title { color: #ffd76a; }

/* Callout Box - DANGER / ERROR */
.callout-box.danger {
    background-color: #f8d7da;
    border-left-color: var(--error-color);
    color: #721c24;
}
.callout-box.danger .callout-title { color: #721c24; }
body.dark-mode .callout-box.danger {
    background-color: #49252a;
    border-left-color: var(--error-color-dark);
    color: #f5c6cb;
}
body.dark-mode .callout-box.danger .callout-title { color: #f5c6cb; }


/* ==========================================================================
   TABLE STYLES
   ========================================================================== */

/* Base Table Style (Used by default in .results) */
.results-table {
    width: 100%;
    margin: 1em 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.results-table th, .results-table td {
    padding: 12px 15px;
    border: 1px solid var(--border-light);
    text-align: left;
    vertical-align: top;
}
.results-table thead th {
    background-color: var(--background-light);
    font-weight: 700;
    color: var(--primary-color-dark);
}
.results-table tbody tr:nth-child(odd) {
    background-color: var(--highlight-bg-light);
}
.results-table td {
    word-break: break-all;
    font-family: var(--code-font-family);
}
.results-table caption {
    caption-side: bottom;
    text-align: center;
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 8px;
    font-style: italic;
}

/* Comparison Table Style (Alternative with more pronounced header) */
.comparison-table thead th {
    background-color: var(--primary-color);
    color: var(--button-text);
}
.comparison-table td:first-child {
    font-weight: 500;
}

/* Dark Mode for Tables */
body.dark-mode .results-table th,
body.dark-mode .results-table td,
body.dark-mode .comparison-table th,
body.dark-mode .comparison-table td {
    border-color: var(--border-dark);
}
body.dark-mode .results-table thead th {
    background-color: var(--input-bg-dark);
    color: var(--link-color);
}
body.dark-mode .results-table tbody tr:nth-child(odd) {
    background-color: var(--highlight-bg-dark);
}
body.dark-mode .comparison-table thead th {
    background-color: var(--link-color);
    color: var(--card-bg-dark);
}
body.dark-mode .results-table caption {
    color: #aaa;
}


/* ==========================================================================
   GENERAL ARTICLE & FAQ STYLES
   ========================================================================== */
.article-container {
    padding: 30px 40px;
}
.article-container h1, .article-container h2, .article-container h3,
.faq-section h1, .faq-section h2 {
    color: var(--primary-color);
    margin-top: 1.5em;
    margin-bottom: 1em;
}
.article-container h1 { font-size: clamp(1.8em, 5vw, 2.2em); margin-top: 0; }
.article-container h2, .faq-section h2 { font-size: clamp(1.5em, 4vw, 1.8em); border-bottom: 2px solid var(--border-light); padding-bottom: 0.3em; }
.article-container h3 { font-size: clamp(1.2em, 3.5vw, 1.4em); }

.article-container p, .article-container li,
.faq-section p, .faq-section li {
    line-height: 1.75;
    font-size: 1rem;
    margin-bottom: 1.2em;
}
.article-container ul, .article-container ol {
    padding-left: 25px;
}
.article-container code {
    background-color: var(--code-bg-light);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: var(--code-font-family);
    font-size: 0.9em;
    word-break: break-word;
}
.article-container pre {
    background-color: var(--code-bg-light);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.9em;
    border: 1px solid var(--border-light);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.faq-section {
    padding: 30px 40px;
    background-color: var(--background-light);
    border-top: 1px solid var(--border-light);
    margin-top: 0;
    border-radius: 0 0 var(--container-border-radius) var(--container-border-radius);
}
.faq-section details {
    background-color: var(--highlight-bg-light);
    border: 1px solid var(--highlight-border-light);
    border-radius: 6px;
    margin-bottom: 1em;
    padding: 12px 18px;
}
.faq-section summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1.1em;
}
.faq-section details[open] summary { margin-bottom: 0.8em; }

/* Dark Mode for Article/FAQ */
body.dark-mode .article-container, 
body.dark-mode .faq-section { border-color: var(--border-dark); }
body.dark-mode .article-container h2, 
body.dark-mode .faq-section h2 { border-bottom-color: var(--border-dark); }
body.dark-mode .article-container code, 
body.dark-mode .article-container pre { background-color: var(--code-bg-dark); border-color: var(--border-dark); }
body.dark-mode .faq-section { background-color: var(--card-bg-dark); }
body.dark-mode .faq-section details { background-color: var(--highlight-bg-dark); border-color: var(--highlight-border-dark); }
body.dark-mode .faq-section summary { color: #a6d4fa; }


/* --- PoE Calculator Styles (Using VLSM card style) --- */
.vlsm-result-card .device-list-header {
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--primary-color-dark);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}
body.dark-mode .vlsm-result-card .device-list-header {
    color: var(--link-color);
    border-bottom-color: var(--border-dark);
}

.vlsm-result-card ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}
.vlsm-result-card ul li {
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.vlsm-result-card ul li strong {
    font-family: var(--code-font-family);
}
.vlsm-result-card dd {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.poe-protocol-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    vertical-align: middle;
}

.poe-protocol-badge.poe-af { background-color: #e7f3fe; color: #0c5460; border: 1px solid #b3d7f9;}
.poe-protocol-badge.poe-at { background-color: #d1e7dd; color: #0f5132; border: 1px solid #a3cfbb;}
.poe-protocol-badge.poe-bt3 { background-color: #fff3cd; color: #856404; border: 1px solid #ffe69c;}
.poe-protocol-badge.poe-bt4 { background-color: #f8d7da; color: #721c24; border: 1px solid #f1b0b7;}

body.dark-mode .poe-protocol-badge.poe-af { background-color: #233f50; color: #a6d4fa; border-color: #37475a;}
body.dark-mode .poe-protocol-badge.poe-at { background-color: #1c3c2e; color: #a3d9b8; border-color: #2a5843;}
body.dark-mode .poe-protocol-badge.poe-bt3 { background-color: #4d3c11; color: #ffd76a; border-color: #66512c;}
body.dark-mode .poe-protocol-badge.poe-bt4 { background-color: #49252a; color: #f5c6cb; border-color: #6c3b40;}

/* --- STYLES FOR PoE INVENTORY CARD AND TABLE (IMPROVED) --- */
.inventory-card .planner-card-header {
    padding: 10px 20px;
}
.inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.inventory-table thead th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border-light);
    font-weight: 500;
    color: #6c757d;
}
.inventory-table tbody td, .inventory-table tfoot td {
    padding: 8px 12px;
    vertical-align: middle;
}
.inventory-table tbody td {
    border-bottom: 1px solid var(--border-light);
}
.inventory-table tfoot {
    border-top: 2px solid var(--border-light);
}
.inventory-table input {
    padding: 8px 10px;
    font-size: 0.9rem;
}
.inventory-table tfoot .apple-like-btn {
    padding: 8px 15px;
    width: 100%;
}
.inventory-table .remove-req-btn {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
}

/* NEW: Toggle Switch for PoE Inventory */
.toggle-switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.toggle-switch-label {
    font-weight: 500;
    cursor: pointer;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(24px);
}
.slider.round {
    border-radius: 26px;
}
.slider.round:before {
    border-radius: 50%;
}


/* DARK MODE for INVENTORY */
body.dark-mode .inventory-table thead th {
    border-bottom-color: var(--border-dark);
    color: #aaa;
}
body.dark-mode .inventory-table tbody td {
    border-bottom-color: var(--border-dark);
}
body.dark-mode .inventory-table tfoot {
    border-top-color: var(--border-dark);
}
body.dark-mode .slider {
    background-color: var(--border-dark);
}
body.dark-mode input:checked + .slider {
    background-color: var(--link-color);
}