/* ============================================================
   Schematics Editor — Domain Kits CSS (Phase 2)
   Mode switcher pills, symbol palette sidebar, domain-specific
   visual styles, drag ghost, component value badges
   ============================================================ */

/* ============================================================
   Mode Switcher Pills
   ============================================================ */
.mode-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    flex-shrink: 0;
}

.mode-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: rgba(0, 0, 0, 0.5);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.mode-pill iconify-icon {
    font-size: 14px;
}

.mode-pill:hover {
    background: rgba(79, 172, 254, 0.12);
    color: #0066cc;
}

.mode-pill.active {
    background: rgba(79, 172, 254, 0.22);
    color: #0066cc;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.4);
}

body.dark-mode .mode-switcher {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .mode-pill {
    color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .mode-pill:hover {
    background: rgba(79, 172, 254, 0.15);
    color: #4facfe;
}

body.dark-mode .mode-pill.active {
    background: rgba(79, 172, 254, 0.25);
    color: #4facfe;
    box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.5);
}

/* ============================================================
   Symbol Palette Sidebar (left rail drawer)
   ============================================================ */
#symbolPalettePanel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 190px;
    background: rgba(18, 18, 28, 0.97);
    border-right: 1px solid rgba(79, 172, 254, 0.15);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#symbolPalettePanel.open {
    transform: translateX(0);
}

.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 8px;
    border-bottom: 1px solid rgba(79, 172, 254, 0.1);
    flex-shrink: 0;
}

.palette-header h4 {
    font-size: 12px;
    font-weight: 600;
    color: #4facfe;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.palette-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    transition: color 0.15s;
}

.palette-close-btn:hover {
    color: #fff;
}

#symbolPalette {
    flex: 1;
    overflow-y: auto;
    padding: 6px 6px 14px;
}

.palette-group-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(79, 172, 254, 0.6);
    padding: 8px 4px 3px;
    user-select: none;
}

.palette-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 2px;
}

.palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 4px;
    border-radius: 6px;
    cursor: grab;
    border: 1px solid rgba(79, 172, 254, 0.12);
    background: rgba(79, 172, 254, 0.04);
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    width: 80px;
    user-select: none;
}

.palette-item:hover {
    background: rgba(79, 172, 254, 0.15);
    border-color: rgba(79, 172, 254, 0.4);
    transform: translateY(-1px);
}

.palette-item:active {
    cursor: grabbing;
    transform: scale(0.96);
}

.palette-icon {
    width: 60px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.palette-icon svg {
    max-width: 60px;
    max-height: 44px;
}

.palette-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.palette-empty {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    padding: 20px 8px;
    font-style: italic;
}

/* ── Drag ghost ─────────────────────────────────────────── */
.palette-drag-ghost {
    pointer-events: none;
    position: fixed;
    z-index: 9999;
    background: rgba(18, 18, 28, 0.9);
    border: 1px solid rgba(79, 172, 254, 0.5);
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.25);
}

/* Palette open button (floating toggle) */
#paletteToggleBtn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 501;
    background: rgba(18, 18, 28, 0.92);
    border: 1px solid rgba(79, 172, 254, 0.25);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: #4facfe;
    padding: 10px 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), left 0.25s;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

#paletteToggleBtn.shifted {
    left: 190px;
}

#paletteToggleBtn:hover {
    background: rgba(79, 172, 254, 0.2);
}

/* Light mode overrides */
body:not(.dark-mode) #symbolPalettePanel {
    background: rgba(245, 248, 255, 0.98);
    border-right: 1px solid rgba(79, 172, 254, 0.2);
}

body:not(.dark-mode) .palette-group-label {
    color: rgba(0, 102, 204, 0.7);
}

body:not(.dark-mode) .palette-item {
    border-color: rgba(0, 102, 204, 0.15);
    background: rgba(0, 102, 204, 0.04);
}

body:not(.dark-mode) .palette-item:hover {
    background: rgba(79, 172, 254, 0.12);
    border-color: rgba(79, 172, 254, 0.4);
}

body:not(.dark-mode) .palette-label {
    color: rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Domain Symbol Styles (inline SVG classes)
   ============================================================ */

/* ── Electrical ─────────────────────────────────────────── */
.domain-symbol.symbol-net-label text.sym-value {
    font-weight: 700;
    font-family: monospace;
}

.domain-symbol .pin-point {
    transition: r 0.12s ease, fill 0.12s ease;
}

.domain-symbol .pin-point:hover {
    r: 4;
    fill: #00f2fe;
    filter: drop-shadow(0 0 4px #00f2fe);
}

/* Wire draw approaching a snap target */
.domain-symbol .pin-point.pin-snap {
    r: 6;
    fill: #00f2fe;
    filter: drop-shadow(0 0 4px #00f2fe88);
}

/* ── Symbol Picker Popover ────────────────────────────────── */
.se-sym-picker {
    position: fixed;
    flex-direction: column;
    background: #0d1b2a;
    border: 1px solid #2d4a6d;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.75);
    z-index: 9999;
    width: 280px;
    max-height: 360px;
    overflow: hidden;
    font-family: Inter, sans-serif;
    font-size: 12px;
    color: #ccd6f6;
    display: none; /* toggled inline */
}
.se-sym-picker-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #1e3a5a;
    flex-shrink: 0;
}
.se-sym-picker-title {
    font-size: 10px;
    font-weight: 700;
    color: #8892b0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.se-sym-picker-search {
    flex: 1;
    background: #162030;
    border: 1px solid #2d4a6d;
    border-radius: 4px;
    color: #ccd6f6;
    padding: 4px 8px;
    font-size: 11px;
    outline: none;
}
.se-sym-picker-search:focus { border-color: #4facfe; }
.se-sym-picker-close {
    background: none;
    border: none;
    color: #8892b0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.se-sym-picker-close:hover { color: #ccd6f6; }
.se-sym-picker-body {
    overflow-y: auto;
    flex: 1;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: #2d4a6d transparent;
}
.se-sym-picker-group {
    font-size: 10px;
    font-weight: 700;
    color: #4facfe;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 0 2px;
}
.se-sym-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.se-sym-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 56px;
    padding: 4px 2px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.1s, border-color 0.1s;
}
.se-sym-picker-item:hover {
    background: #162030;
    border-color: #4facfe;
}
.se-sym-picker-icon {
    width: 40px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.se-sym-picker-label {
    font-size: 9px;
    color: #8892b0;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    margin-top: 2px;
    pointer-events: none;
}

/* ── UML ─────────────────────────────────────────────────── */
.domain-symbol.symbol-class-box rect {
    transition: fill 0.15s;
}

.domain-symbol.symbol-class-box:hover rect {
    fill: rgba(79, 172, 254, 0.12);
}

.domain-symbol .sym-value {
    cursor: text;
    user-select: none;
}

/* ── Floorplan ───────────────────────────────────────────── */
.domain-symbol.symbol-wall-h rect,
.domain-symbol.symbol-wall-v rect {
    transition: fill 0.15s;
}

.domain-symbol.symbol-dimension text.sym-value {
    font-size: 10px;
    font-family: monospace;
}

/* ============================================================
   Component Value Badge (double-click to edit)
   ============================================================ */
.domain-symbol .sym-value {
    paint-order: stroke;
    stroke: rgba(18, 18, 28, 0.6);
    stroke-width: 2px;
}

/* ============================================================
   Export Domain Buttons (shown per-mode in export toolbar)
   ============================================================ */
.export-domain-btn {
    display: none;
}