@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #16161e;
    --bg-tertiary: #1a1b26;
    --bg-card: #1f2335;
    --bg-hover: #292e42;
    --accent-primary: #7ee83f;
    --accent-secondary: #ff5370;
    --accent-tertiary: #82aaff;
    --accent-warning: #ffb86c;
    --text-primary: #e4f0fb;
    --text-secondary: #a9b8cc;
    --text-muted: #5c6e87;
    --border-primary: #1f2937;
    --border-accent: #374151;
    --shadow-subtle: 0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.7);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Menlo', monospace;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    height: 100vh;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(22, 22, 30, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* Hamburger Menu */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    font-family: 'JetBrains Mono', monospace;
}

.header h1::before {
    content: '◆';
    font-size: 16px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.gcp-logo {
    width: 20px;
    height: 20px;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-right: 24px;
    padding: 0 8px;
    border-right: 1px solid var(--border-primary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: rgba(31, 35, 53, 0.6);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-secondary);
    padding: 6px 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    margin-right: 8px;
}

.mobile-menu-icon {
    font-size: 18px;
    line-height: 1;
}

.mobile-menu-btn:hover {
    background: rgba(41, 46, 66, 0.8);
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

/* Mobile Dropdown Menu */
.mobile-dropdown-menu {
    display: none;
    position: absolute;
    top: 48px;
    right: 12px;
    background: rgba(31, 35, 53, 0.98);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px;
    box-shadow: var(--shadow-elevated);
    z-index: 101;
    min-width: 150px;
}

.mobile-dropdown-menu.active {
    display: block;
}

.mobile-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.mobile-dropdown-item:hover {
    background: rgba(130, 170, 255, 0.1);
    color: var(--accent-tertiary);
    padding-left: 16px;
}

.nav-link {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    position: relative;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.3px;
}

.nav-link:hover {
    background: rgba(130, 170, 255, 0.08);
    color: var(--accent-tertiary);
    border-radius: 6px;
}

.nav-link:active {
    background: rgba(130, 170, 255, 0.12);
    color: var(--accent-tertiary);
}

/* Active state for navigation */
.nav-link.active {
    background: rgba(130, 170, 255, 0.1);
    color: var(--accent-tertiary);
    font-weight: 500;
}

.vpc-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
}

.vpc-tabs {
    display: flex;
    gap: 1px;
}

.vpc-tab {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 400;
    font-family: 'JetBrains Mono', monospace;
}

.vpc-tab.active {
    background: var(--bg-secondary);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.vpc-tab:hover:not(.active) {
    color: var(--text-secondary);
    border-color: var(--border-accent);
}

.btn {
    padding: 8px 16px;
    background: rgba(31, 35, 53, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: rgba(41, 46, 66, 0.8);
    border-color: var(--border-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--bg-secondary);
    border-color: var(--border-accent);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-success {
    background: rgba(126, 232, 63, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-success:hover {
    background: rgba(126, 232, 63, 0.2);
    box-shadow: 0 0 12px rgba(126, 232, 63, 0.3);
}

.btn-danger {
    background: rgba(255, 83, 112, 0.1);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.btn-danger:hover {
    background: rgba(255, 83, 112, 0.2);
    box-shadow: 0 0 12px rgba(255, 83, 112, 0.3);
}

.btn.success {
    background: rgba(126, 232, 63, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(126, 232, 63, 0.3);
}

.btn.saving {
    background: rgba(130, 170, 255, 0.1);
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
    cursor: wait;
}

/* Main Layout */
.main-content {
    display: flex;
    width: 100%;
    margin-top: 56px;
    position: relative;
    z-index: 5;
    min-height: calc(100vh - 56px);
}

/* Left Sidebar - Spaces */
.spaces-sidebar {
    width: 260px;
    background: rgba(22, 22, 30, 0.95);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
}

/* Hide spaces sidebar when no spaces configured */
.spaces-sidebar.hidden {
    display: none;
}

/* Ensure sidebar stays interactive on mobile */
@media (max-width: 768px) {
    .spaces-sidebar {
        pointer-events: auto !important;
    }
    
    .spaces-sidebar * {
        pointer-events: auto !important;
    }
}

.spaces-sidebar::-webkit-scrollbar {
    width: 6px;
}

.spaces-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.spaces-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 3px;
}

.spaces-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-tertiary), var(--accent-primary));
}

.spaces-sidebar h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 1px;
    position: relative;
    padding-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.spaces-sidebar h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20px;
    height: 1px;
    background: var(--accent-primary);
}

/* Sidebar Navigation Section (Mobile only) */
.sidebar-nav-section {
    display: none;
    padding: 16px;
    border-bottom: 1px solid var(--border-primary);
    background: rgba(31, 35, 53, 0.4);
}

.sidebar-nav-link {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    text-decoration: none;
}

.sidebar-nav-link:last-child {
    margin-bottom: 0;
}

.sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Space Search */
.space-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.space-search input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(31, 35, 53, 0.6);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    transition: all var(--transition-fast);
}

.space-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(31, 35, 53, 0.8);
    box-shadow: 0 0 0 2px rgba(126, 232, 63, 0.1);
}

.space-search input::placeholder {
    color: var(--text-muted);
}

/* Space List */
.space-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.space-item {
    padding: 12px 14px;
    margin-bottom: 6px;
    background: rgba(31, 35, 53, 0.5);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    overflow: hidden;
}

.space-item:hover {
    background: rgba(41, 46, 66, 0.7);
    border-color: var(--border-accent);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.space-item.active {
    background: rgba(41, 46, 66, 0.9);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(126, 232, 63, 0.15);
}

.space-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 0 4px 4px 0;
}

.space-header, .space-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.space-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    letter-spacing: 0.3px;
}

.space-cidr {
    font-size: 14px;
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    background: rgba(126, 232, 63, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(126, 232, 63, 0.3);
    display: inline-block;
    margin-top: 2px;
}

.space-util {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.space-util-bar {
    flex: 1;
    height: 4px;
    background: rgba(22, 22, 30, 0.4);
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.space-util-fill {
    height: 100%;
    transition: width var(--transition-medium);
    border-radius: 2px;
}

.space-util-text {
    font-size: 9px;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

/* Add Space Button */
.add-space-section {
    padding: 12px;
    border-top: 1px solid var(--border-primary);
}

.add-space-btn {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.1), rgba(130, 170, 255, 0.1));
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.add-space-btn:hover {
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.2), rgba(130, 170, 255, 0.2));
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(126, 232, 63, 0.25);
}

.template-grid {
    display: grid;
    gap: 6px;
    margin-bottom: 24px;
}

.template-btn {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.template-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.template-btn .template-title {
    font-weight: 500;
    margin-bottom: 3px;
    color: var(--text-primary);
    font-size: 12px;
}

.template-btn .template-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
}

.info-panel {
    background: var(--bg-card);
    padding: 12px;
    margin-bottom: 24px;
    font-size: 11px;
    border: 1px solid var(--border-primary);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-primary);
}

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

.info-label {
    color: var(--text-muted);
    font-weight: 400;
}

.info-value {
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

/* Visualization Area */
.visualization {
    flex: 1;
    padding: 24px;
    overflow: auto;
    height: calc(100vh - 56px);
    position: relative;
    z-index: 10;
    background: transparent;
    min-width: 0; /* Allow flex shrinking */
    display: block !important;
    min-height: calc(100vh - 56px);
}

/* Full width visualization when sidebars are hidden */
.visualization.full-width {
    width: 100%;
    display: block !important;
}

.visualization::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.visualization::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.visualization::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 4px;
}

.visualization::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
}

.visualization::-webkit-scrollbar-corner {
    background: transparent;
}



.vpc-container {
    background: rgba(31, 35, 53, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-elevated);
    transition: all var(--transition-fast);
}

.vpc-container:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.vpc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.3);
    gap: 20px;
}

.vpc-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vpc-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0;
    font-family: 'JetBrains Mono', monospace;
}

.vpc-cidr {
    font-size: 15px;
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.15), rgba(130, 170, 255, 0.1));
    padding: 6px 12px;
    border: 1px solid rgba(126, 232, 63, 0.4);
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(126, 232, 63, 0.15);
}

.vpc-actions {
    display: flex;
    gap: 8px;
}

.vpc-actions .action-btn {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    font-size: 10px;
    font-weight: 500;
    min-width: 80px;
}

.vpc-actions .action-btn:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
}

.subnet-list {
    margin-top: 8px;
}

.subnet-card {
    background: rgba(22, 22, 30, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: 4px 120px 1fr auto auto;
    align-items: center;
    gap: 14px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    font-size: 11px;
    min-height: 40px;
    overflow: hidden;
}

.subnet-card:hover {
    border-color: var(--border-accent);
    background: rgba(41, 46, 66, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.subnet-card.selected {
    border-color: var(--border-accent);
    background: var(--bg-hover);
}

.subnet-card.unallocated {
    background: repeating-linear-gradient(
        135deg,
        rgba(22, 22, 30, 0.3),
        rgba(22, 22, 30, 0.3) 10px,
        rgba(26, 27, 38, 0.3) 10px,
        rgba(26, 27, 38, 0.3) 20px
    );
    border: 2px dashed rgba(92, 110, 135, 0.4);
    opacity: 0.85;
    position: relative;
}

.subnet-card.unallocated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 35, 53, 0.7);
    pointer-events: none;
}

.subnet-card.unallocated * {
    position: relative;
    z-index: 1;
}

.subnet-card.unallocated .subnet-name {
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
}

.subnet-card.unallocated:hover {
    opacity: 1;
    border-color: var(--border-accent);
}

.subnet-card.unallocated:hover::before {
    background: rgba(31, 35, 53, 0.8);
}

/* Depth-based styling - removed, will be handled dynamically */

/* Unallocated summary */
.unallocated-summary {
    background: repeating-linear-gradient(
        45deg,
        var(--bg-secondary),
        var(--bg-secondary) 8px,
        var(--bg-tertiary) 8px,
        var(--bg-tertiary) 16px
    );
    border: 1px dashed var(--border-accent);
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 11px;
    position: relative;
    border-radius: 8px;
}

.unallocated-summary:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.unallocated-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 35, 53, 0.7);
    pointer-events: none;
}

.unallocated-summary * {
    position: relative;
    z-index: 1;
}

.unallocated-summary .summary-info {
    color: var(--text-secondary) !important;
}

.unallocated-summary:hover {
    border-color: var(--border-accent);
}

.unallocated-summary:hover::before {
    background: rgba(31, 35, 53, 0.8);
}

.unallocated-summary.expanded {
    border-color: var(--border-accent);
}

.summary-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.summary-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.summary-actions {
    display: flex;
    gap: 8px;
}

.summary-actions .action-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 500;
    min-width: 80px;
}

.expand-icon {
    transition: transform var(--transition-fast);
    font-size: 14px;
    color: var(--accent-tertiary);
    padding: 4px;
    margin-right: 4px;
    border-radius: 4px;
    background: rgba(130, 170, 255, 0.1);
    border: 1px solid rgba(130, 170, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
}

.expand-icon:hover {
    background: rgba(130, 170, 255, 0.2);
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

.expand-icon.expanded {
    transform: rotate(90deg);
    background: rgba(130, 170, 255, 0.2);
    border-color: var(--accent-tertiary);
}

.subnet-indicator {
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, transparent, var(--text-muted), transparent);
    border-radius: 2px;
    grid-column: 1;
    justify-self: center;
    transition: all var(--transition-fast);
}

.subnet-card.primary .subnet-indicator {
    background: linear-gradient(180deg, transparent, var(--accent-primary), transparent);
    box-shadow: 0 0 8px rgba(126, 232, 63, 0.3);
}

.subnet-card.secondary .subnet-indicator {
    background: linear-gradient(180deg, transparent, var(--accent-tertiary), transparent);
    box-shadow: 0 0 8px rgba(130, 170, 255, 0.3);
}

.subnet-cidr {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
    grid-column: 2;
}

.subnet-name {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 6px;
    transition: all 0.15s ease;
    font-weight: 400;
    font-family: 'JetBrains Mono', monospace;
    grid-column: 3;
}

.subnet-name[contenteditable]:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.subnet-name[contenteditable]:focus {
    outline: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-accent);
}

.subnet-info {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    grid-column: 4;
    justify-self: end;
}

.subnet-stat {
    display: flex;
    gap: 3px;
    font-family: 'JetBrains Mono', monospace;
}

.subnet-actions {
    display: flex;
    gap: 6px;
    grid-column: 5;
    justify-self: end;
}

.action-btn {
    padding: 8px 14px;
    background: rgba(31, 35, 53, 0.6);
    border: 1px solid var(--border-accent);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    min-width: 70px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.action-btn:hover {
    background: rgba(126, 232, 63, 0.15);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(126, 232, 63, 0.2);
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(126, 232, 63, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.action-btn:active::before {
    width: 200px;
    height: 200px;
}

.action-btn:disabled, .action-btn[disabled] {
    background: rgba(22, 22, 30, 0.3) !important;
    border-color: rgba(92, 110, 135, 0.3) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    transform: none;
    opacity: 0.4;
    filter: grayscale(100%);
}

.action-btn:disabled:hover, .action-btn[disabled]:hover {
    background: rgba(22, 22, 30, 0.3) !important;
    color: var(--text-muted) !important;
    transform: none;
    box-shadow: none;
}

.action-btn[style*="color: #22c55e"] {
    background: rgba(0, 255, 65, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.action-btn[style*="color: #22c55e"]:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.action-btn[style*="color: #fbbf24"] {
    background: rgba(255, 191, 36, 0.1);
    border-color: #fbbf24;
    color: #fbbf24;
}

.action-btn[style*="color: #fbbf24"]:hover {
    background: #fbbf24;
    color: var(--bg-primary);
}

.action-btn[style*="color: #ef4444"] {
    background: rgba(255, 0, 128, 0.1);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.action-btn[style*="color: #ef4444"]:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
}

/* Enhanced Action Button Variants - Tokyo Night Style */
.action-btn-primary {
    background: rgba(130, 170, 255, 0.08) !important;
    border-color: var(--accent-tertiary) !important;
    color: var(--accent-tertiary) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.action-btn-primary:hover {
    background: rgba(130, 170, 255, 0.15) !important;
    color: var(--accent-tertiary) !important;
    box-shadow: 0 0 12px rgba(130, 170, 255, 0.3);
    transform: translateY(-2px);
}

.action-btn-success {
    background: rgba(126, 232, 63, 0.08) !important;
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.action-btn-success:hover {
    background: rgba(126, 232, 63, 0.15) !important;
    color: var(--accent-primary) !important;
    box-shadow: 0 0 12px rgba(126, 232, 63, 0.3);
    transform: translateY(-2px);
}

.action-btn-warning {
    background: rgba(224, 175, 104, 0.06) !important;
    border-color: #e0af68 !important;
    color: #e0af68 !important;
    font-weight: 500 !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.action-btn-warning:hover {
    background: rgba(224, 175, 104, 0.12) !important;
    color: #e6bb7a !important;
    box-shadow: 0 0 4px rgba(224, 175, 104, 0.15);
}

.action-btn-danger {
    background: rgba(255, 83, 112, 0.08) !important;
    border-color: var(--accent-secondary) !important;
    color: var(--accent-secondary) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.action-btn-danger:hover {
    background: rgba(255, 83, 112, 0.15) !important;
    color: var(--accent-secondary) !important;
    box-shadow: 0 0 12px rgba(255, 83, 112, 0.3);
    transform: translateY(-2px);
}

.action-btn-neutral {
    background: rgba(154, 165, 206, 0.1) !important;
    border-color: #9aa5ce !important;
    color: #c0caf5 !important;
    font-weight: 500 !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.action-btn-neutral:hover {
    background: rgba(154, 165, 206, 0.2) !important;
    color: #e0e5f7 !important;
    border-color: #b0bbde !important;
    box-shadow: 0 0 4px rgba(154, 165, 206, 0.25);
}

/* Add VPC Dialog */
.dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(31, 35, 53, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 24px;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-elevated);
    min-width: 420px;
    animation: dialogSlideIn 0.3s ease-out;
}

@keyframes dialogSlideIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.dialog.active {
    display: block;
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    transition: opacity var(--transition-fast);
    pointer-events: none; /* Don't block when hidden */
}

.dialog-overlay.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
    pointer-events: auto; /* Enable when active */
}

/* Ensure custom dialog overlay behaves the same */
#custom-dialog-overlay {
    pointer-events: none;
}

#custom-dialog-overlay.active {
    pointer-events: auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dialog h3 {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.dialog-header h3 {
    margin: 0;
}

.dialog-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.dialog-close:hover {
    background: rgba(255, 83, 112, 0.1);
    color: var(--accent-secondary);
}

.dialog-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 8px;
}

.dialog-content::-webkit-scrollbar {
    width: 6px;
}

.dialog-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.dialog-content::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 3px;
}

.dialog-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-tertiary);
}

.dialog-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 10px 12px;
    background: rgba(22, 22, 30, 0.6);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    transition: all var(--transition-fast);
    font-family: 'JetBrains Mono', monospace;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(41, 46, 66, 0.6);
    box-shadow: 0 0 0 2px rgba(126, 232, 63, 0.1);
}

.dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Split Dialog Styles */
#split-range-dialog {
    min-width: 500px;
    max-width: 600px;
}

.split-info {
    margin-bottom: 24px;
}

.split-current {
    background: rgba(22, 22, 30, 0.4);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
}

.split-current label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.split-current-cidr {
    font-size: 16px;
    color: var(--accent-primary);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.split-controls {
    margin-bottom: 24px;
}

.split-controls label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
}

.slider-container {
    position: relative;
    padding: 20px 0 30px;
}

.split-slider {
    width: 100%;
    height: 6px;
    background: rgba(22, 22, 30, 0.6);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.split-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(126, 232, 63, 0.3);
    transition: all var(--transition-fast);
}

.split-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 12px rgba(126, 232, 63, 0.5);
}

.split-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(126, 232, 63, 0.3);
    transition: all var(--transition-fast);
}

.split-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 12px rgba(126, 232, 63, 0.5);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 2px;
}

.slider-labels span {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.slider-labels span:hover {
    color: var(--text-primary);
}

.split-value {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.split-value span {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 18px;
}

.split-preview {
    margin-top: 24px;
}

.split-preview label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 4px;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(22, 22, 30, 0.2);
    border-radius: 8px;
}

.preview-item {
    background: rgba(126, 232, 63, 0.1);
    border: 1px solid rgba(126, 232, 63, 0.3);
    border-radius: 4px;
    padding: 8px 4px;
    text-align: center;
    font-size: 10px;
    color: var(--accent-primary);
    transition: all var(--transition-fast);
    animation: previewItemFadeIn 0.3s ease-out;
}

@keyframes previewItemFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.preview-item:hover {
    background: rgba(126, 232, 63, 0.2);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.preview-details {
    background: rgba(22, 22, 30, 0.4);
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.preview-details::-webkit-scrollbar {
    width: 6px;
}

.preview-details::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.preview-details::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 3px;
}

.preview-details::-webkit-scrollbar-thumb:hover {
    background: var(--accent-tertiary);
}

.subnet-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 4px;
    background: rgba(22, 22, 30, 0.3);
    border-radius: 4px;
    font-size: 11px;
    transition: all var(--transition-fast);
}

.subnet-detail:hover {
    background: rgba(41, 46, 66, 0.4);
}

.subnet-detail-name {
    color: var(--text-secondary);
}

.subnet-detail-cidr {
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.subnet-detail-size {
    color: var(--text-muted);
    font-size: 10px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 40px auto;
    background: rgba(31, 35, 53, 0.3);
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    backdrop-filter: blur(8px);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.empty-state p {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 24px;
}

/* Empty State Actions */
.empty-state-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    margin-top: 32px;
}

.empty-state-add-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.1), rgba(130, 170, 255, 0.1));
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    min-width: 220px;
    position: relative;
    overflow: hidden;
}

.empty-state-add-btn:hover {
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.2), rgba(130, 170, 255, 0.2));
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(126, 232, 63, 0.4);
    transform: translateY(-2px) scale(1.02);
}

.empty-state-templates {
    width: 100%;
    max-width: 500px;
}

.empty-state-templates h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 1px;
    font-family: 'JetBrains Mono', monospace;
}

.empty-state-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.empty-state-template-btn {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.empty-state-template-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.empty-state-template-btn .template-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 12px;
}

.empty-state-template-btn .template-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Hide sidebar elements when no spaces */
.spaces-sidebar.empty-state-active .space-search,
.spaces-sidebar.empty-state-active .space-list {
    display: none;
}

.spaces-sidebar.empty-state-active .add-space-section {
    border-top: none;
    padding-top: 0;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: rgba(31, 35, 53, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-elevated);
    font-size: 12px;
    min-width: 150px;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
    font-family: 'JetBrains Mono', monospace;
}

.context-menu-item:hover {
    background: rgba(126, 232, 63, 0.1);
    color: var(--accent-primary);
    padding-left: 16px;
}

.context-menu-separator {
    height: 1px;
    background: var(--border-primary);
    margin: 4px 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .spaces-sidebar {
        width: 200px;
    }
}

/* Mobile overlay for sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 94; /* Below sidebar but above content */
    transition: opacity var(--transition-fast);
    pointer-events: none; /* Don't block clicks when hidden */
}

.sidebar-overlay.active {
    display: block;
    pointer-events: auto; /* Enable clicks when active */
}

@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important; /* Never show on desktop */
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .header {
        padding: 8px 12px;
    }
    
    .header h1 {
        margin-right: 0;
        font-size: 14px;
        flex: 1;
    }
    
    /* Hide desktop nav menu on mobile */
    .nav-menu {
        display: none !important;
    }
    
    /* Show sidebar nav section on mobile */
    .sidebar-nav-section {
        display: block !important;
    }
    
    /* Ensure header actions are visible */
    .header-actions {
        display: flex !important;
        gap: 8px;
        margin-left: auto;
    }
    
    .header-actions .btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .main-content {
        margin-top: 48px;
    }
    
    /* Transform sidebar into mobile drawer */
    .spaces-sidebar {
        position: fixed;
        top: 48px;
        left: -280px;
        width: 280px;
        height: calc(100vh - 48px);
        max-height: none;
        background: var(--bg-secondary); /* Ensure solid background */
        border-right: 1px solid var(--border-primary);
        border-bottom: none;
        transition: left 0.3s ease;
        z-index: 96; /* Above overlay */
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    }
    
    .spaces-sidebar.active {
        left: 0;
    }
    
    /* Hide when no spaces, even if active */
    .spaces-sidebar.hidden {
        display: none !important;
    }
    
    .visualization {
        width: 100%;
        height: calc(100vh - 48px);
        padding: 16px;
        position: relative;
        z-index: 1; /* Ensure it's above any stray overlays */
        background: transparent;
    }
    
    .visualization.full-width {
        width: 100%;
    }
    
    /* Ensure main content is always accessible */
    .main-content {
        position: relative;
        z-index: 1;
        background: transparent;
    }
    
    /* Make sure vpc-container is visible */
    #vpc-container {
        position: relative;
        z-index: 2;
    }
    
    .dialog {
        width: 90%;
        max-width: 90%;
        min-width: unset;
        padding: 16px;
    }
    
    #split-range-dialog {
        min-width: unset;
        max-width: 90%;
    }
    
    .slider-labels {
        font-size: 9px;
    }
    
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    }
    
    /* Adjust space cards for mobile */
    .spaces-grid {
        grid-template-columns: 1fr;
    }
    
    /* Adjust empty state for mobile */
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-state-template-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 13px;
    }
    
    .header h1::before {
        display: none;
    }
    
    /* Ensure header controls work on small screens */
    .header-controls {
        flex: initial;
        margin-left: auto;
    }
    
    .header-actions {
        display: flex !important;
        gap: 4px;
    }
    
    .header-actions .btn {
        padding: 4px 8px;
        font-size: 10px;
        min-width: auto;
    }
    
    /* Hide Share button on very small screens to save space */
    #share-btn {
        display: none;
    }
    
    .subnet-card {
        grid-template-columns: 4px 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px;
    }
    
    .subnet-cidr {
        grid-column: 2;
        grid-row: 1;
        font-size: 11px;
    }
    
    .subnet-name {
        grid-column: 2;
        grid-row: 2;
    }
    
    .subnet-info {
        grid-column: 2;
        grid-row: 3;
        justify-self: start;
    }
    
    .subnet-actions {
        grid-column: 2;
        grid-row: 4;
        justify-self: start;
        flex-wrap: wrap;
    }
    
    .action-btn {
        font-size: 9px;
        padding: 4px 8px;
        min-width: 50px;
    }
    
    /* Simplify range display on mobile */
    .range-header {
        flex-wrap: wrap;
    }
    
    .range-actions {
        width: 100%;
        margin-top: 8px;
        margin-left: 0;
    }
}

/* Additional utility classes for inline styles */

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

/* Loading animations */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(126, 232, 63, 0.1) 50%, transparent 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Hover focus improvements */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Improved transitions for all interactive elements */
button, a, input, select, textarea {
    transition: all var(--transition-fast);
}

/* Enhanced shadow utilities */
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5); }
.shadow-xl { box-shadow: 0 20px 25px rgba(0, 0, 0, 0.6); }

/* Glow effects for active elements */
.glow-primary {
    box-shadow: 0 0 20px rgba(126, 232, 63, 0.4);
}

.glow-secondary {
    box-shadow: 0 0 20px rgba(255, 83, 112, 0.4);
}

.glow-tertiary {
    box-shadow: 0 0 20px rgba(130, 170, 255, 0.4);
}

/* Hide reset button when no spaces */
#reset-all-btn.hidden {
    display: none;
}

/* Hide share button when no spaces */
#share-btn.hidden {
    display: none;
}



.empty-message {
    color: #64748b;
    text-align: center;
    font-size: 11px;
}

#vpc-cidr-input {
    background: #1e293b;
    color: #e2e8f0;
}

/* Space Overview Cards */
.all-spaces-view {
    padding: 24px;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.all-spaces-view h2 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 500;
}

.spaces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.space-card {
    background: rgba(31, 35, 53, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.space-card:hover {
    background: rgba(41, 46, 66, 0.8);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-elevated);
    transform: translateY(-4px) scale(1.02);
}

.space-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    transition: left 0.5s ease;
}

.space-card:hover::before {
    left: 100%;
}

.space-card h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 500;
}

.space-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cidr-label {
    font-size: 16px;
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.1), rgba(130, 170, 255, 0.05));
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(126, 232, 63, 0.3);
    display: inline-block;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stats {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Utilization bars */
.utilization-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    overflow: hidden;
    margin-top: 8px;
}

.utilization-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.utilization-text {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.utilization-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.utilization-percentage {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

/* Delete Space Button */
.delete-space-btn {
    background: transparent;
    border: none;
    color: var(--accent-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.delete-space-btn:hover {
    opacity: 1;
}

/* Space Container */
.space {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    padding: 20px;
    margin-bottom: 16px;
}

.space-header-info {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.space-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.space-title h2 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.space-cidr-badge {
    font-size: 16px;
    color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(126, 232, 63, 0.15), rgba(130, 170, 255, 0.1));
    padding: 8px 14px;
    border: 2px solid rgba(126, 232, 63, 0.5);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 12px rgba(126, 232, 63, 0.2);
    display: inline-block;
}

.space-stats {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 12px;
}

.stat-item {
    display: flex;
    gap: 6px;
}

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

.stat-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* Ranges Container */
.ranges-container {
    padding: 8px 0;
}

.root-consolidate-container {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-accent);
    display: flex;
    justify-content: center;
}

.root-consolidate-container .action-btn {
    width: auto;
    padding: 6px 16px;
}

/* Range Items */
.range {
    padding: 14px 16px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(26, 27, 38, 0.7) 0%, rgba(22, 22, 30, 0.6) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(31, 41, 55, 0.5);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 11px;
    position: relative;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Visual feedback for expandable rows */
.range:has(.expand-icon):hover {
    background: rgba(41, 46, 66, 0.8);
    padding-left: 16px;
}

.range:hover {
    background: linear-gradient(135deg, rgba(41, 46, 66, 0.85) 0%, rgba(31, 35, 53, 0.75) 100%);
    border-color: rgba(126, 232, 63, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(126, 232, 63, 0.1);
}

.range.selected {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.range.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 0 2px 2px 0;
}

.range.unallocated:not(:has(.range-children)) {
    background: repeating-linear-gradient(
        45deg,
        var(--bg-secondary),
        var(--bg-secondary) 8px,
        var(--bg-tertiary) 8px,
        var(--bg-tertiary) 16px
    );
    border: 1px dashed var(--border-accent);
    opacity: 0.8;
}

/* For browsers that don't support :has(), use a class */
.range.unallocated.leaf {
    background: repeating-linear-gradient(
        45deg,
        var(--bg-secondary),
        var(--bg-secondary) 8px,
        var(--bg-tertiary) 8px,
        var(--bg-tertiary) 16px
    );
    border: 1px dashed var(--border-accent);
    opacity: 0.8;
}

.range-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.range-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
    letter-spacing: 0.2px;
}

.range-name[contenteditable="true"], .range-name.editing {
    outline: none;
    padding: 2px 4px;
    border: 1px solid var(--border-accent);
    background: var(--bg-hover);
    border-radius: 2px;
}

.range-name::selection {
    background: rgba(122, 162, 247, 0.35);
}

.range-cidr {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(126, 232, 63, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(126, 232, 63, 0.2);
}

.range-ips {
    color: var(--text-muted);
    opacity: 0.7;
    font-size: 10px;
    font-size: 10px;
}

.range-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.range-actions .action-btn {
    padding: 4px 8px;
    font-size: 10px;
    min-width: 60px;
}

.range-children {
    margin-top: 8px;
    /* Remove extra container indentation to avoid compounded shrinking */
    margin-left: 0;
}

.expand-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.15s ease;
    cursor: pointer;
    user-select: none;
}

.expand-icon.expanded {
    transform: rotate(90deg);
    background: rgba(130, 170, 255, 0.2);
    border-color: var(--accent-tertiary);
}

.expand-placeholder {
    display: inline-block;
    width: 32px;
}

.level-indicator {
    font-size: 9px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 2px;
}

.tag {
    font-size: 9px;
    color: var(--accent-primary);
    background: rgba(158, 206, 106, 0.1);
    padding: 2px 6px;
    border: 1px solid var(--accent-primary);
    margin-left: 4px;
}

/* Allocation Summary */
.allocation-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-primary);
}

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

.allocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.allocation-name {
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 500;
}

.allocation-percentage {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.allocation-cidr {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.allocation-stats {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

