/* ============================================================
   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);
}

/* ── 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;
}