/* DropPlanner - Light Theme */

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

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --surface: #ffffff;
    --surface-hover: #f1f3f4;
    --border: #dadce0;
    --border-light: #e8eaed;
    --text: #202124;
    --text-muted: #80868b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(60,64,67,0.1), 0 8px 16px rgba(60,64,67,0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --transition: all 0.2s ease;
}

html, body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: #e5e7eb;
    color: var(--text);
    line-height: 1.4;
    font-size: 13px;
    height: 100%;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ==================== TITLE BAR ==================== */
.title-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 48px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.title-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.title-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.title-company {
    font-size: 9px;
    color: rgba(255,255,255,0.7);
    margin-top: -2px;
}

.title-separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.3);
    margin: 0 16px;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0 14px;
    height: calc(100% - 8px);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    margin: 4px 2px;
}

.nav-btn:hover,
.nav-item.open .nav-btn {
    background: rgba(255,255,255,0.15);
}

/* Dropdown */
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 1000;
    padding: 6px;
}

.nav-item.open .nav-dropdown {
    display: block;
    animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-dropdown-item:hover:not(:disabled) {
    background: var(--surface-hover);
}

.nav-dropdown-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-dropdown-item .shortcut {
    color: var(--text-muted);
    font-size: 12px;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

/* Title Right Section */
.title-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.title-status {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-status.loading { color: #fff; }
.title-status.success { color: #a8e6cf; }
.title-status.error { color: #ffb3b3; }

.title-zoom {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.title-zoom-btn {
    background: transparent;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.title-zoom-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

.title-zoom-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.title-zoom-level {
    color: white;
    font-size: 12px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

/* ==================== SECONDARY TOOLBAR ==================== */
.toolbar-secondary {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 48px;
    gap: 0;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.toolbar-section.flex-grow {
    flex: 1;
}

.toolbar-sep {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 12px;
    flex-shrink: 0;
}

/* Project Info */
.project-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-client {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.project-separator {
    color: var(--text-muted);
    font-weight: 400;
}

.project-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.project-unsaved {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbc04;
    margin-left: 4px;
}

/* Toolbar Buttons */
.btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    background: var(--surface-hover);
    color: var(--text);
}

.btn:hover:not(:disabled) {
    background: #e2e5e9;
    border-color: var(--text-muted);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 6px 8px;
    min-width: 32px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(26,115,232,0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #1557b0;
    box-shadow: 0 2px 6px rgba(26,115,232,0.4);
}

.btn-success {
    background: #34a853;
    color: white;
    border-color: #34a853;
    box-shadow: 0 1px 3px rgba(52,168,83,0.3);
}

.btn-success:hover:not(:disabled) {
    background: #2d8e47;
}

.btn-warning {
    background: #fbbc04;
    color: var(--text);
    border-color: #fbbc04;
    box-shadow: 0 1px 3px rgba(251,188,4,0.3);
}

.btn-warning:hover:not(:disabled) {
    background: #f9a825;
}

.btn-toggle {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-toggle.active:hover:not(:disabled) {
    background: #1557b0;
}

/* Zoom Display */
.zoom-display {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Current Tool Indicator */
.current-tool {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
    padding: 6px 12px;
    background: rgba(26,115,232,0.1);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* Status Text */
.status-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Template Slot & Preview */
.template-slot {
    min-width: 44px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
}

.template-slot.has-template {
    background: rgba(26,115,232,0.1);
    border: 1px solid var(--primary);
}

.template-preview {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-preview img {
    max-width: 28px;
    max-height: 28px;
    border: 1px solid var(--primary);
    border-radius: 3px;
    background: #fff;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    line-height: 1;
}

.btn-clear:hover {
    color: var(--danger);
}

/* Legacy button styles for compatibility */
.toolbar-btn {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.toolbar-btn:hover:not(:disabled) {
    background: #e2e5e9;
    border-color: #c0c4c9;
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn.highlight-yellow {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.toolbar-btn.highlight-yellow:hover:not(:disabled) {
    background: #fde68a;
}

.toolbar-btn.highlight-green {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.toolbar-btn.highlight-green:hover:not(:disabled) {
    background: #a7f3d0;
}

.toolbar-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Connection Status */
.connection-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.connection-status.connected {
    background: #22c55e;
}

.connection-status.disconnected {
    background: #ef4444;
}

/* Buttons */
.btn {
    padding: 5px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1557b0; }

.btn-secondary { background: #e8eaed; color: #333; }
.btn-secondary:hover:not(:disabled) { background: #d2d4d7; }

.btn-success { background: #34a853; color: #fff; }
.btn-success:hover:not(:disabled) { background: #2d8e47; }

.btn-warning { background: #fbbc04; color: #333; }
.btn-warning:hover:not(:disabled) { background: #e5ac00; }

.btn-danger { background: #ea4335; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c5221f; }

.btn.active { background: #ea4335; color: #fff; }

.btn-small { padding: 4px 8px; font-size: 11px; }

.file-label {
    display: inline-block;
    cursor: pointer;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 12px;
    flex-shrink: 0; /* Don't shrink */
}

.btn-icon {
    padding: 5px 8px;
    min-width: 28px;
}

.connection-status { color: #999; font-size: 11px; }
/* Main Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Important for flex child scrolling */
}

/* Tool Palette */
.tool-palette {
    width: 56px;
    min-width: 56px;
    background: linear-gradient(180deg, #2d2d2d 0%, #1f1f1f 100%);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    position: relative;
    z-index: 100;
}

.tool-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tool-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tool-group-label {
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
    position: relative;
}

.tool-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #bbb;
}

.tool-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(26,115,232,0.4);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Tool button with flyout indicator */
.tool-btn-wrapper {
    position: relative;
}

.tool-btn.has-flyout::after {
    content: '►';
    position: absolute;
    right: 3px;
    bottom: 3px;
    font-size: 6px;
    color: #555;
}

.tool-btn.has-flyout:hover::after,
.tool-btn.has-flyout.active::after {
    color: rgba(255,255,255,0.6);
}

/* Flyout Menus */
.tool-flyout {
    display: none;
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 140px;
    padding: 6px;
    z-index: 1000;
    animation: flyoutFade 0.15s ease;
}

@keyframes flyoutFade {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

.tool-btn-wrapper.open .tool-flyout {
    display: block;
}

.flyout-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

.flyout-item:hover {
    background: var(--surface-hover);
}

.flyout-item.has-submenu::after {
    content: '►';
    font-size: 8px;
    color: var(--text-muted);
    margin-left: 12px;
}

.flyout-item .color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
}

.flyout-item .item-text {
    flex: 1;
}

.flyout-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

/* Submenu (Level 2) */
.flyout-submenu {
    display: none;
    position: absolute;
    left: calc(100% + 4px);
    top: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    padding: 6px;
    z-index: 1001;
}

.flyout-item.open > .flyout-submenu {
    display: block;
}

/* Level 3 submenu */
.flyout-submenu.level-3 {
    z-index: 1002;
}

/* Level 4 submenu (port counts) */
.flyout-submenu.level-4 {
    z-index: 1003;
    min-width: 100px;
}

.flyout-subitem {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
}

.flyout-subitem:hover {
    background: var(--primary);
    color: white;
}

/* Plan Container */
.plan-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    min-width: 0; /* Important for flex child */
}

.plan-toolbar {
    padding: 6px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-label input {
    cursor: pointer;
}

.grid-size-select {
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.plan-wrapper {
    position: relative;
    flex: 1;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: auto;
    margin: 10px;
}

.plan-wrapper.plan-hidden {
    background: #e8e8e8;
}

.plan-wrapper.plan-hidden #planImage {
    opacity: 0.15;
}

.plan-inner {
    position: relative;
    display: inline-block;
    transform-origin: top left;
}

#planImage {
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.2s;
}

/* Resize Handle */
.resize-handle {
    width: 6px;
    background: #e0e0e0;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.15s;
}

.resize-handle:hover,
.resize-handle.dragging {
    background: #1a73e8;
}

.selection-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    cursor: default;
}

.selection-canvas.crosshair {
    cursor: crosshair;
}

.selection-canvas.grab {
    cursor: grab;
}

.selection-canvas.grabbing {
    cursor: grabbing;
}

.plan-wrapper.space-down .selection-canvas {
    cursor: grab;
}

.placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
}


/* ==================== RIGHT SIDEBAR ==================== */
.right-sidebar {
    width: 280px;
    min-width: 200px;
    max-width: 450px;
    background: #fff;
    border-left: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
}

.right-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-left: none;
}

.right-sidebar.grid-mode {
    width: 800px;
    min-width: 600px;
    max-width: 1200px;
}

/* Resize Handle */
.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    background: transparent;
    z-index: 10;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
    background: #1a73e8;
}

/* Mode Toggle Bar */
.mode-toggle-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    gap: 8px;
    flex-shrink: 0;
}

.mode-toggle-bar span {
    font-size: 12px;
    color: #555;
}

.mode-toggle {
    display: flex;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.mode-toggle button {
    padding: 6px 12px;
    font-size: 11px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.mode-toggle button.active {
    background: #1a73e8;
    color: #fff;
}

.mode-toggle button:hover:not(.active) {
    background: #d0d0d0;
}

/* Panel Sections */
.panel-section {
    border-bottom: 1px solid #e0e0e0;
}

.panel-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f5f5f5;
    cursor: pointer;
    user-select: none;
}

.panel-header:hover {
    background: #ebebeb;
}

.panel-header .collapse-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    transition: transform 0.2s;
}

.panel-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.panel-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    border: none;
    padding: 0;
}

.panel-content {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.panel-header.collapsed + .panel-content {
    display: none;
}

/* Detail Mode Content */
.detail-mode-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.grid-mode .detail-mode-content {
    display: none;
}

/* Properties Panel - No Selection */
.no-selection {
    color: #888;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Properties Panel - Selection Summary */
.selection-summary {
    background: #e3f2fd;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #1565c0;
}

/* Properties Panel - Property Groups */
.property-group {
    margin-bottom: 12px;
}

.property-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.property-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.property-row:last-child {
    margin-bottom: 0;
}

.property-label {
    width: 80px;
    font-size: 12px;
    color: #555;
    flex-shrink: 0;
}

.property-value {
    flex: 1;
}

.property-value input[type="text"],
.property-value select,
.property-value textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.property-value input:focus,
.property-value select:focus,
.property-value textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

.property-value textarea {
    resize: vertical;
    min-height: 60px;
}

.property-value select {
    cursor: pointer;
}

/* Cable Type Indicator */
.cable-type-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cable-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cable-color-dot.cat5e { background: #9c27b0; }
.cable-color-dot.cat6 { background: #2196f3; }
.cable-color-dot.cat6a { background: #4caf50; }
.cable-color-dot.fiber { background: #f44336; }
.cable-color-dot.coax { background: #ff9800; }
.cable-color-dot.audio { background: #00bcd4; }

/* Grid Mode Content */
.grid-mode-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.grid-mode .grid-mode-content {
    display: flex;
    flex-direction: column;
}

/* Grid Tabs */
.grid-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.grid-tab {
    padding: 10px 16px;
    font-size: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #555;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.grid-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    background: #fff;
}

.grid-tab:hover:not(.active) {
    background: #ebebeb;
}

/* Grid Toolbar */
.grid-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    gap: 8px;
    flex-shrink: 0;
}

.grid-toolbar button {
    padding: 6px 12px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-toolbar button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.grid-toolbar .spacer {
    flex: 1;
}

.grid-toolbar .selection-count {
    font-size: 12px;
    color: #666;
}

/* Grid Container */
.grid-container {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* Data Grid Table */
.data-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-grid th {
    position: sticky;
    top: 0;
    background: #f5f5f5;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
    z-index: 1;
}

.data-grid th.sortable {
    cursor: pointer;
}

.data-grid th.sortable:hover {
    background: #ebebeb;
}

.data-grid td {
    padding: 2px 4px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.data-grid tr:hover {
    background: #f8f8f8;
}

.data-grid tr.selected {
    background: #e3f2fd;
}

.data-grid tr.selected:hover {
    background: #d0e8fc;
}

/* Grid Cell (inline editing) */
.grid-cell {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    background: transparent;
    transition: all 0.15s;
}

.grid-cell:hover {
    border-color: #ddd;
    background: #fff;
}

.grid-cell:focus {
    outline: none;
    border-color: #1a73e8;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

select.grid-cell {
    cursor: pointer;
}

/* Grid Column Widths */
.col-select { width: 40px; text-align: center; }
.col-label { width: 80px; }
.col-cable { width: 100px; }
.col-purpose { width: 110px; }
.col-room { width: 140px; }
.col-notes { min-width: 150px; }
.col-visible { width: 50px; text-align: center; }

/* Row Checkbox */
.row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Grid Visibility Toggle */
.grid-visibility {
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: #666;
    margin: 0 auto;
    display: block;
}

.grid-visibility.hidden {
    color: #ccc;
}

/* Grid Cable Cell */
.grid-cable-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grid-cable-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.grid-cable-dot.cat5e { background: #9c27b0; }
.grid-cable-dot.cat6 { background: #2196f3; }
.grid-cable-dot.cat6a { background: #4caf50; }
.grid-cable-dot.fiber { background: #f44336; }
.grid-cable-dot.coax { background: #ff9800; }
.grid-cable-dot.audio { background: #00bcd4; }

/* Layers Panel */
.layers-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.grid-mode .layers-section {
    display: none;
}

.layers-tree {
    font-size: 12px;
}

/* Layer Category */
.layer-category {
    margin-bottom: 4px;
}

.layer-category-header {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
}

.layer-category-header:hover {
    background: #f0f0f0;
}

.layer-category-header .expand-icon {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    transition: transform 0.2s;
    color: #666;
}

.layer-category-header.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.layer-category-header .category-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    color: #555;
}

.layer-category-header .category-name {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.layer-category-header .category-count {
    font-size: 11px;
    color: #888;
    margin-right: 8px;
}

.layer-category-header .visibility-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: #666;
    padding: 2px;
    border-radius: 3px;
}

.layer-category-header .visibility-toggle:hover {
    background: #e0e0e0;
}

.layer-category-header .visibility-toggle.hidden {
    color: #bbb;
}

/* Layer Items */
.layer-items {
    margin-left: 20px;
    border-left: 1px solid #e0e0e0;
    padding-left: 8px;
}

.layer-category-header.collapsed + .layer-items {
    display: none;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px 0;
}

.layer-item:hover {
    background: #f0f0f0;
}

.layer-item.selected {
    background: #e3f2fd;
}

.layer-item .item-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    flex-shrink: 0;
}

.layer-item .item-icon.drop { color: #2196f3; }
.layer-item .item-icon.mdf { color: #1565c0; }
.layer-item .item-icon.room { color: #ff9800; }
.layer-item .item-icon.route { color: #9c27b0; }

.layer-item .item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.layer-item .item-visibility {
    width: 16px;
    height: 16px;
    cursor: pointer;
    color: #666;
    padding: 1px;
    border-radius: 3px;
    flex-shrink: 0;
}

.layer-item .item-visibility:hover {
    background: #e0e0e0;
}

.layer-item .item-visibility.hidden {
    color: #ccc;
}

/* Panel Actions */
.panel-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.panel-actions button {
    flex: 1;
    padding: 6px 10px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.panel-actions button:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Sidebar Scrollbars */
.panel-content::-webkit-scrollbar,
.grid-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.panel-content::-webkit-scrollbar-track,
.grid-container::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.panel-content::-webkit-scrollbar-thumb,
.grid-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 400px;
    max-width: 90vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-hint {
    font-size: 11px;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.modal-field {
    margin-bottom: 15px;
}

.modal-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
}

.modal-field select,
.modal-field input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.modal-field select:focus,
.modal-field input:focus {
    border-color: #1a73e8;
    outline: none;
}

.modal-field-row {
    display: flex;
    gap: 6px;
}

.modal-field-row select {
    flex: 2;
    min-width: 180px;
}

.modal-field-row input {
    flex: 1;
    min-width: 80px;
}

.modal-field-row-2col {
    display: flex;
    gap: 16px;
}

.modal-field-row-2col .modal-field {
    flex: 1;
}

.modal-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 15px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-section-label:first-of-type {
    margin-top: 5px;
}

.modal-field.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.modal-footer-right {
    display: flex;
    gap: 8px;
}

/* Selection info in header */
#selectionInfo {
    font-size: 11px;
    color: #1a73e8;
    font-weight: normal;
}

/* Routes Panel */
.route-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fff;
}

.route-item.route-hidden {
    opacity: 0.5;
}

.route-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-visibility input {
    margin: 0;
}

.route-name {
    font-weight: 600;
    color: #333;
}

.route-dest {
    color: #666;
    font-size: 11px;
}

.route-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #666;
    padding-left: 24px;
}

.route-actions {
    display: flex;
    justify-content: flex-end;
}

.routes-help {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    color: #666;
}

.no-routes {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

.toggle-label.compact {
    margin: 0;
    padding: 0;
}

.toggle-label.compact span {
    font-size: 14px;
}

/* Layer item details */
.item-details {
    color: #888;
    font-size: 10px;
    font-weight: normal;
}

/* Filter Section */
.filter-section {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
}

.filter-group {
    margin-bottom: 8px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.filter-chip:hover {
    border-color: #999;
}

.filter-chip.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
}

.filter-chip.inactive {
    background: #f5f5f5;
    color: #999;
    border-color: #e0e0e0;
}

.filter-chip .chip-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.filter-chip .chip-count {
    font-size: 9px;
    opacity: 0.7;
}

/* Filtered out items in layers list */
.layer-item.filtered-out {
    opacity: 0.4;
}
