:root {
    --background: #ffffff;
    --foreground: #020817;
    --card: #ffffff;
    --card-foreground: #020817;
    --popover: #ffffff;
    --popover-foreground: #020817;
    --primary: #0f172a;
    --primary-foreground: #f8fafc;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #0f172a;
    --destructive: #ef4444;
    --destructive-foreground: #f8fafc;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #020817;
    --radius: 0.5rem;
}

.dark {
    --background: #020817;
    --foreground: #f8fafc;
    --card: #020817;
    --card-foreground: #f8fafc;
    --popover: #020817;
    --popover-foreground: #f8fafc;
    --primary: #f8fafc;
    --primary-foreground: #0f172a;
    --secondary: #1e293b;
    --secondary-foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --accent: #1e293b;
    --accent-foreground: #f8fafc;
    --destructive: #7f1d1d;
    --destructive-foreground: #f8fafc;
    --border: #1e293b;
    --input: #1e293b;
    --ring: #cbd5e1;
}

/* === LAYERING & ANIMATIONS === */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.floating-numbers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.number {
    position: absolute;
    bottom: -50px;
    font-size: 2rem;
    color: rgba(74, 144, 226, 0.15);
    animation: floatUp linear infinite;
    user-select: none;
    font-weight: 300;
}

@keyframes floatUp {
    from {
        transform: translateY(0);
        opacity: 0.15;
    }

    to {
        transform: translateY(-100vh);
        opacity: 0;
    }
}

.dark .number {
    color: rgba(74, 144, 226, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    position: relative;
    z-index: 3;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .container {
    background-color: rgba(2, 8, 23, 0.92);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--foreground);
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Form Group for Labeled Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--foreground);
}

.input-wrapper {
    display: flex;
    align-items: center;
}

.input-wrapper input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex: 1;
}

.input-wrapper select {
    background-color: var(--muted);
    border: 1px solid var(--border);
    color: var(--foreground);
    padding: 0.5rem 1rem;
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    height: 100%;
    /* Match input height */
    cursor: pointer;
    font-weight: 500;
}

.input-wrapper select:hover {
    background-color: var(--accent);
}

input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    width: 100%;
}

button {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

.results {
    background-color: var(--secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 2rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.version-toggle {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.version-btn {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.version-btn.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

/* === TABLE STYLES === */
.table-container {
    position: relative;
    z-index: 3;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark .table-container {
    background-color: rgba(2, 8, 23, 0.92);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.table-container h2 {
    color: var(--foreground);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: left;
}

.table thead {
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 700;
}

.table tbody tr:nth-child(odd) {
    background-color: var(--secondary);
}

.table tbody tr:nth-child(even) {
    background-color: var(--background);
}

.table tbody tr:hover {
    background-color: var(--accent);
    transition: background-color 0.2s ease;
}

.table tbody tr td[colspan] {
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 700;
    text-align: center;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .number {
        font-size: 1.5rem;
    }
}

/* === SUBNET MAP STYLES === */
.subnet-map {
    margin-top: 1rem;
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.map-bar {
    display: flex;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.map-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
}

.map-segment.network {
    width: 40px;
    background-color: #64748b;
    cursor: help;
}

.map-segment.usable {
    flex-grow: 1;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    cursor: help;
}

.map-segment.broadcast {
    width: 40px;
    background-color: #64748b;
    cursor: help;
}

.map-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    justify-content: center;
    color: var(--muted-foreground);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.network,
.dot.broadcast {
    background-color: #64748b;
}

.dot.usable {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

@media (max-width: 480px) {
    .map-bar {
        font-size: 0.7rem;
    }
}

/* === TAB STYLES (for VLSM) === */
.tab-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted-foreground);
    transition: all 0.2s;
}

.tab:hover {
    color: var(--foreground);
}

.tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === VLSM STYLES === */
.vlsm-inputs {
    margin-bottom: 2rem;
}

.subnet-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.subnet-row input {
    flex: 1;
}

.btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-add {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    width: 100%;
    margin-top: 1rem;
    border: 1px dashed var(--border);
}

.btn-add:hover {
    background-color: var(--muted);
    border-color: var(--primary);
}

.btn-remove {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
}

/* === ADMIN TOOLS STYLES === */
.summary-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.summary-row input {
    flex: 1;
}