/* ============================================================
   ElektroPlan – Main Stylesheet
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #1a56db;
  --primary-dark: #1245b0;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f97316;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;
  --panel-w: 280px;
  --header-h: 56px;
  --viewbar-h: 44px;
  --hints-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: 13px; }
label { cursor: pointer; }
svg { display: block; flex-shrink: 0; }

/* ---------- HEADER ---------- */
#app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  box-shadow: var(--shadow);
  z-index: 100;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.header-center { display: flex; align-items: center; justify-content: center; gap: 8px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo svg { width: 32px; height: 32px; }
.logo-text { font-size: 18px; color: var(--text); letter-spacing: -.3px; }
.logo-text strong { color: var(--primary); }

.project-name-wrap { flex: 1; min-width: 0; max-width: 280px; }
#project-name {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
#project-name:hover { background: var(--bg); border-color: var(--border); }
#project-name:focus { outline: none; background: white; border-color: var(--primary); }

.mode-toggle { display: flex; align-items: center; gap: 6px; }
.mode-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.mode-btn {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  background: transparent;
  transition: all .15s;
}
.mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.mode-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

.btn-icon {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all .15s;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { background: var(--bg); color: var(--text); border-color: var(--border); }

.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: background .15s, transform .1s;
  border: none;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.97); }
.btn-primary.large { padding: 10px 20px; font-size: 15px; }
.btn-primary svg { width: 18px; height: 18px; }

.btn-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: all .15s;
}
.btn-outline:hover { background: var(--primary-light); }

.btn-outline-small {
  padding: 4px 10px;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.btn-outline-small:hover { background: var(--primary-light); }

.btn-danger-small {
  padding: 6px 12px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  transition: all .15s;
}
.btn-danger-small:hover { background: #fef2f2; }

/* ---------- VIEW BAR ---------- */
#view-bar {
  height: var(--viewbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 90;
}
.view-toggle { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; gap: 2px; }
.view-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn:hover { color: var(--text); background: rgba(255,255,255,.6); }
.view-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow); }

.floor-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.floor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all .15s;
}
.floor-tab:hover { background: var(--bg); color: var(--text); }
.floor-tab.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.canvas-tools { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-shrink: 0; }
.symbol-size-control {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  flex-shrink: 0;
}
#symbol-size-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 22px;
  text-align: center;
}
.size-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0;
  flex-shrink: 0;
}
.size-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.size-btn:active { transform: scale(.9); }
.tool-divider { width: 1px; height: 20px; background: var(--border); margin: 0 2px; flex-shrink: 0; }
.tool-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: white;
  transition: all .15s;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { background: var(--bg); color: var(--text); }
.tool-btn:active { transform: scale(.93); }

/* ---------- MAIN LAYOUT ---------- */
#app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ---------- LEFT SIDEBAR ---------- */
#sidebar-left {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.upload-section { padding: 12px; border-bottom: 1px solid var(--border); }
.upload-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--primary-light);
  cursor: pointer;
  transition: all .2s;
}
.upload-drop-zone:hover, .upload-drop-zone.drag-over {
  border-color: var(--primary);
  background: #dbeafe;
}
.upload-drop-zone svg { width: 36px; height: 36px; margin-bottom: 2px; }
.upload-drop-zone p { font-size: 13px; color: var(--text); }
.upload-drop-zone p.small { font-size: 11px; color: var(--text-muted); }
.upload-drop-zone .btn-outline { font-size: 12px; padding: 5px 12px; margin-top: 2px; }

.palette-search { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.palette-search input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14'%3E%3Ccircle cx='11' cy='11' r='8' fill='none' stroke='%2394a3b8' stroke-width='2'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65' stroke='%2394a3b8' stroke-width='2'/%3E%3C/svg%3E") 8px center no-repeat;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s;
}
.palette-search input:focus { outline: none; border-color: var(--primary); background-color: white; }

#element-palette {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
#element-palette::-webkit-scrollbar { width: 4px; }
#element-palette::-webkit-scrollbar-track { background: transparent; }
#element-palette::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.palette-category { margin-bottom: 2px; }
.palette-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.palette-category-header:hover { color: var(--text); }
.palette-cat-toggle { font-size: 10px; transition: transform .2s; }
.palette-category.collapsed .palette-cat-toggle { transform: rotate(-90deg); }
.palette-category.collapsed .palette-items { display: none; }

.palette-items { display: flex; flex-direction: column; gap: 1px; padding: 0 6px 6px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: grab;
  transition: background .12s;
  user-select: none;
  border: 1.5px solid transparent;
}
.palette-item:hover { background: var(--bg); }
.palette-item.selected { background: var(--primary-light); border-color: var(--primary); }
.palette-item:active { cursor: grabbing; }
.palette-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
}
.palette-item-label { flex: 1; min-width: 0; }
.palette-item-label strong { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item-label span { font-size: 11px; color: var(--text-muted); }

.link-tool-section {
  padding: 12px;
  background: var(--accent-light);
  border-top: 1px solid #fde68a;
}
.link-tool-info strong { display: block; font-size: 13px; margin-bottom: 4px; color: #92400e; }
.link-tool-info p { font-size: 12px; color: #92400e; margin-bottom: 8px; }

/* ---------- CANVAS AREA ---------- */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #e8edf4;
  background-image:
    linear-gradient(rgba(100,120,160,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,120,160,.08) 1px, transparent 1px);
  background-size: 20px 20px;
}
#main-canvas { display: block; }

#canvas-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 237, 244, 0.95);
  z-index: 10;
}
.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 380px;
  padding: 24px;
}
.empty-state-content h2 { font-size: 22px; color: var(--text); }
.empty-state-content p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.hint-text { font-size: 12px; color: var(--text-light); }

/* Placing cursor state */
body.placing-element #canvas-container { cursor: crosshair; }
body.placing-element .palette-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* ---------- RIGHT PANEL ---------- */
#panel-right {
  width: var(--panel-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}
#panel-right::-webkit-scrollbar { width: 4px; }
#panel-right::-webkit-scrollbar-track { background: transparent; }
#panel-right::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

#panel-no-selection {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px 20px;
  text-align: center;
}
.panel-placeholder svg { width: 40px; height: 40px; opacity: .4; }
.panel-placeholder p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.quick-stats { padding: 16px; border-top: 1px solid var(--border); margin-top: auto; }
.quick-stats h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 10px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.stat-item .stat-num { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-item .stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.panel-element-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-el-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.panel-el-name { font-size: 15px; font-weight: 700; }
.panel-el-type { font-size: 12px; color: var(--text-muted); }

.panel-section { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-section label:not(.wish-item):not(.section-title) {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.section-title { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 8px; }

.panel-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.panel-input:focus { outline: none; border-color: var(--primary); background: white; }
.panel-input.short { width: 80px; }

.panel-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.panel-select:focus { outline: none; border-color: var(--primary); }

.panel-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  min-height: 60px;
}
.panel-textarea:focus { outline: none; border-color: var(--primary); background: white; }

.height-input-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit { font-size: 13px; color: var(--text-muted); }
.hint-inline { font-size: 11px; color: var(--text-light); }

.wishes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wish-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  transition: all .15s;
  cursor: pointer;
}
.wish-item:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.wish-item input { display: none; }
.wish-icon { font-size: 14px; }

#linked-elements-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.linked-el-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}
.linked-el-chip button { font-size: 14px; color: var(--text-muted); line-height: 1; }
.linked-el-chip button:hover { color: var(--danger); }

.panel-actions { padding: 12px 16px; }

/* ---------- HINTS BAR ---------- */
#hints-bar {
  height: var(--hints-h);
  background: var(--accent-light);
  border-top: 1px solid #fde68a;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  transition: height .2s, opacity .2s;
}
#hints-bar.hidden { height: 0; overflow: hidden; opacity: 0; pointer-events: none; }
#hints-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
#hints-container::-webkit-scrollbar { display: none; }
.hint-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: #92400e;
  cursor: pointer;
  transition: all .15s;
}
.hint-item:hover { background: var(--accent-light); border-color: var(--accent); }
.hint-item .hint-icon { font-size: 14px; }
.hints-close { color: var(--text-muted); font-size: 20px; line-height: 1; padding: 4px 8px; flex-shrink: 0; }
.hints-close:hover { color: var(--text); }

/* ---------- MODALS ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s ease-out;
}
.modal.large { max-width: 760px; }
.modal.xlarge { max-width: 960px; }
@keyframes modal-in {
  from { transform: translateY(10px) scale(.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 20px;
  color: var(--text-muted);
  transition: all .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Room Manager */
.room-manager-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.room-list-panel { display: flex; flex-direction: column; gap: 8px; }
.room-template-panel h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.room-templates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.room-template-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  transition: all .15s;
  cursor: pointer;
}
.room-template-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.room-template-btn .room-icon { font-size: 24px; }

.room-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s;
}
.room-item:hover { border-color: var(--primary); }
.room-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
}
.room-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text);
}
.room-item-name:focus { outline: none; border-bottom: 1px solid var(--primary); }
.room-item-count { font-size: 11px; color: var(--text-muted); }
.room-item-delete { color: var(--text-light); font-size: 16px; }
.room-item-delete:hover { color: var(--danger); }

/* Floor Manager */
.floor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.floor-item input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.floor-item input:focus { outline: none; border-bottom: 1px solid var(--primary); }

/* Export */
.export-preview {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}
.export-preview img { max-width: 100%; max-height: 260px; border-radius: 4px; box-shadow: var(--shadow-md); }
.export-loading { color: var(--text-muted); font-size: 13px; }
.export-options h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.export-option-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.export-option-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.export-option-group input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }
.export-buttons { display: flex; gap: 10px; margin-bottom: 14px; }
.export-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 12px;
  color: #7f1d1d;
  line-height: 1.5;
}
.export-disclaimer svg { flex-shrink: 0; margin-top: 1px; }

/* Share */
.share-options { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.share-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.share-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.share-option input { margin-top: 2px; accent-color: var(--primary); }
.share-option div strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.share-option div span { font-size: 12px; color: var(--text-muted); }
.share-link-display {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
#share-link-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
}
.btn-copy {
  padding: 7px 14px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s;
}
.btn-copy:hover { background: var(--primary-dark); }

/* Welcome */
.welcome-body { padding: 32px; text-align: center; }
.welcome-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.welcome-logo h1 { font-size: 26px; }
.welcome-logo h1 span { color: var(--primary); }
.welcome-subtitle { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.welcome-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; text-align: left; }
.welcome-step { display: flex; align-items: flex-start; gap: 14px; }
.step-num {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.welcome-step div strong { display: block; font-size: 14px; margin-bottom: 2px; }
.welcome-step div p { font-size: 13px; color: var(--text-muted); }
.welcome-disclaimer {
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  text-align: left;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Overview */
#overview-content { display: flex; flex-direction: column; gap: 20px; }
.overview-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.overview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.overview-table th { text-align: left; padding: 7px 10px; background: var(--bg); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.overview-table td { padding: 7px 10px; border-top: 1px solid var(--border); }
.overview-table tr:hover td { background: var(--bg); }

/* ---------- CONTEXT MENU ---------- */
#context-menu {
  position: fixed;
  z-index: 900;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 4px;
  animation: ctx-in .12s ease-out;
}
@keyframes ctx-in {
  from { transform: scale(.95); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ctx-item {
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.ctx-item:hover { background: var(--bg); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: #fef2f2; }
.ctx-divider { height: 1px; background: var(--border); margin: 3px 0; }

/* ---------- TOOLTIP ---------- */
#tooltip {
  position: fixed;
  z-index: 1000;
  background: #1e293b;
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  max-width: 220px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
}
#tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #1e293b;
}

/* ---------- ELEMENT LINK LINES ---------- */
.link-line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5,3; fill: none; pointer-events: none; }

/* ---------- SCROLLBARS ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 200px;
    --panel-w: 240px;
  }
}
@media (max-width: 700px) {
  #sidebar-left { display: none; }
  :root { --panel-w: 220px; }
  .header-center { display: none; }
  .btn-icon span { display: none; }
}
@media (max-width: 520px) {
  #panel-right { display: none; }
}

/* ---------- ANIMATIONS ---------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
.placing-active { animation: pulse 1s infinite; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- CROP MODAL ---------- */
.crop-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 20px;
}
.crop-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}
.crop-transform-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.crop-hints-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}
.crop-hints-right span { display: flex; align-items: center; gap: 4px; }
.crop-canvas-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  background: #1e293b;
  border-radius: 8px;
  padding: 16px;
  min-height: 200px;
}
#crop-canvas {
  display: block;
  border-radius: 2px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: crosshair;
  max-width: 100%;
}

/* ---------- PDF PAGE PICKER ---------- */
.pdf-page-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.pdf-page-thumb:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pdf-page-thumb.loading {
  opacity: .6;
  pointer-events: none;
}
.pdf-page-thumb canvas {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow);
  display: block;
}
.pdf-page-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.pdf-page-thumb:hover .pdf-page-num {
  color: var(--primary);
}

/* ---------- ELEMENT ICONS ON CANVAS (colors) ---------- */
.el-steckdosen { background: #dbeafe; color: #1d4ed8; }
.el-schalter { background: #dcfce7; color: #15803d; }
.el-licht { background: #fef9c3; color: #854d0e; }
.el-netzwerk { background: #f3e8ff; color: #7e22ce; }
.el-geraete { background: #fee2e2; color: #b91c1c; }
.el-sonstiges { background: #e0f2fe; color: #0369a1; }

/* Sidebar section */
.sidebar-section { }

/* Panel section visible fix */
#panel-element { padding-bottom: 16px; }

/* Disabled state */
button:disabled { opacity: .4; cursor: not-allowed; }

/* Focus visible for accessibility */
button:focus-visible, input:focus-visible, .btn-icon:focus-visible, .tool-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ============================================================
   STÜCKLISTE / MATERIAL LIST
   ============================================================ */
.stueckliste-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stueckliste-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
}
.stueckliste-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stueckliste-group-title .group-count {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.stueckliste-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.stueckliste-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.stueckliste-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.stueckliste-table tr:hover td {
  background: var(--primary-light);
}
.stueckliste-table .col-count {
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  width: 60px;
}
.stueckliste-table .col-notes {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 200px;
}
#stueckliste-summary {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
#stueckliste-summary .summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#stueckliste-summary .summary-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
#stueckliste-summary .summary-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============================================================
   ACTIVITY LOG
   ============================================================ */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.activity-icon.owner { background: var(--primary-light); }
.activity-icon.electrician { background: #fef3c7; }
.activity-body { flex: 1; }
.activity-actor {
  font-weight: 600;
  font-size: 12px;
}
.activity-desc {
  color: var(--text-muted);
  margin-top: 2px;
}
.activity-time {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

/* ============================================================
   AUTH & PROJECT PICKER SCREENS
   ============================================================ */
.auth-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: linear-gradient(145deg, #f0f5ff 0%, #dbeafe 40%, #c7d9f7 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.auth-container {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 24px; padding: 44px 40px 36px;
  box-shadow: 0 24px 80px rgba(26,86,219,.08), 0 8px 24px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  width: 100%; max-width: 400px;
  animation: authFadeIn .4s ease-out;
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-img { height: 80px; object-fit: contain; margin-bottom: 6px; }
.auth-subtitle {
  color: #6b7280; font-size: 14px; margin: 0; letter-spacing: .01em;
}
.auth-form h2 {
  font-size: 17px; font-weight: 600; color: #1e293b;
  margin: 0 0 22px; text-align: center; letter-spacing: -.01em;
}
.auth-field { margin-bottom: 18px; }
.auth-field label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.auth-field input {
  width: 100%; padding: 11px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 15px; transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box; background: rgba(255,255,255,.7);
}
.auth-field input:focus {
  border-color: #1a56db; outline: none;
  box-shadow: 0 0 0 3px rgba(26,86,219,.1), 0 1px 2px rgba(26,86,219,.06);
}
.auth-field input::placeholder { color: #b0b8c4; }
.auth-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.auth-btn-primary {
  width: 100%; padding: 13px; background: #1a56db; color: #fff; border: none;
  border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(26,86,219,.25);
  margin-top: 4px;
}
.auth-btn-primary:hover { background: #1e40af; box-shadow: 0 4px 14px rgba(26,86,219,.3); }
.auth-btn-primary:active { transform: scale(.985); }
.auth-btn-primary:disabled { background: #93c5fd; cursor: wait; box-shadow: none; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: #6b7280; }
.auth-switch a { color: #1a56db; text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.auth-logout { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb; }

/* Project Screen */
.project-screen-container { max-width: 520px; padding: 32px; }
.project-screen-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
  padding-bottom: 20px; border-bottom: 1px solid #e5e7eb;
}
.project-screen-header h1 { font-size: 20px; font-weight: 700; color: #1e293b; margin: 0; flex: 1; }
.project-screen-user { display: flex; align-items: center; gap: 10px; }
.project-screen-user span { font-size: 12px; color: #9ca3af; }
.project-screen-user a { font-size: 12px; color: #ef4444; text-decoration: none; }
.project-screen-user a:hover { text-decoration: underline; }

/* Project List */
.project-list { margin-bottom: 16px; max-height: 360px; overflow-y: auto; padding: 3px 3px 0; margin-left: -3px; margin-right: -3px; }
.project-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: all .15s;
  background: #fff;
}
.project-card:hover { border-color: #1a56db; background: #eff6ff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(26,86,219,.08); }
.project-card-info h3 { font-size: 15px; font-weight: 600; color: #1e293b; margin: 0; }
.project-card-info p { font-size: 12px; color: #9ca3af; margin: 3px 0 0; }
.project-card-arrow { color: #cbd5e1; font-size: 18px; transition: color .15s; }
.project-card:hover .project-card-arrow { color: #1a56db; }
.project-card-delete {
  background: none; border: none; color: #e2e8f0; font-size: 15px; cursor: pointer;
  padding: 5px 7px; border-radius: 6px; margin-left: 4px; line-height: 1; transition: all .15s;
}
.project-card-delete:hover { color: #ef4444; background: #fef2f2; }

/* New Project */
.project-new { margin-bottom: 20px; }
.project-new-input-wrap { display: flex; gap: 8px; }
.project-new-input-wrap input {
  flex: 1; padding: 10px 14px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  font-size: 14px; box-sizing: border-box; outline: none; transition: border-color .15s;
}
.project-new-input-wrap input:focus { border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.08); }
.project-new-input-wrap .auth-btn-primary { width: auto; padding: 10px 18px; white-space: nowrap; font-size: 14px; border-radius: 8px; }

/* ============================================================
   Elektriker Chat (sidebar)
   ============================================================ */
.elek-chat {
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(26,86,219,.12);
  box-shadow: 0 4px 16px rgba(26,86,219,.08), 0 1px 3px rgba(0,0,0,.06);
  box-sizing: border-box;
  width: 100%;
  margin-top: 4px;
}
.elek-chat-header {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, #1a56db, #2563eb);
  color: #fff; padding: 10px 14px;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
}
.elek-chat-messages {
  flex: 1; min-height: 200px; max-height: 280px;
  overflow-y: auto; padding: 10px 10px 6px;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(248,250,255,.6);
  scroll-behavior: smooth;
}
.elek-chat-messages::-webkit-scrollbar { width: 3px; }
.elek-chat-messages::-webkit-scrollbar-thumb { background: rgba(26,86,219,.2); border-radius: 2px; }
.elek-chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; padding: 24px 0;
  color: #9ca3af; font-size: 12px; text-align: center;
}
.elek-chat-msg { display: flex; }
.elek-chat-msg.from-owner { justify-content: flex-start; }
.elek-chat-msg.from-elek  { justify-content: flex-end; }
.elek-chat-bubble {
  max-width: 82%; padding: 7px 11px 5px;
  border-radius: 12px; font-size: 13px; line-height: 1.45;
}
.from-owner .elek-chat-bubble {
  background: #fff;
  border: 1px solid rgba(26,86,219,.15);
  border-bottom-left-radius: 4px;
}
.from-elek .elek-chat-bubble {
  background: linear-gradient(135deg, #1a56db, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.elek-chat-sender {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  margin-bottom: 2px; opacity: .65; text-transform: uppercase;
}
.elek-chat-text { word-break: break-word; }
.elek-chat-time {
  font-size: 10px; margin-top: 3px; opacity: .55; text-align: right;
}
.elek-chat-input-row {
  display: flex; align-items: center;
  border-top: 1px solid rgba(26,86,219,.1);
  background: rgba(255,255,255,.8); padding: 8px;
  gap: 6px; box-sizing: border-box;
}
.elek-chat-input {
  flex: 1; min-width: 0;
  border: 1.5px solid #e2e8f0; border-radius: 20px;
  padding: 7px 12px; font-size: 13px; outline: none;
  background: rgba(255,255,255,.9); transition: border-color .2s;
  box-sizing: border-box;
}
.elek-chat-input:focus { border-color: #1a56db; }
.elek-chat-send-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #1a56db, #2563eb);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .15s;
}
.elek-chat-send-btn:hover { transform: scale(1.08); }
.elek-chat-send-btn:active { transform: scale(.95); }

/* Trash Section */
.trash-section { border-top: 1px solid #f1f5f9; padding-top: 12px; }
.trash-toggle-btn {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; cursor: pointer; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: #94a3b8; transition: all .15s;
}
.trash-toggle-btn:hover { background: #f8fafc; color: #64748b; }
.trash-toggle-btn.open { color: #64748b; background: #f8fafc; }
.trash-toggle-btn.open #trash-chevron { transform: rotate(180deg); }
.trash-items-list { padding: 8px 0 4px; }
.trash-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 6px;
  background: #fffbeb; border: 1px solid #fde68a;
}
.trash-item-info { flex: 1; min-width: 0; }
.trash-item-info strong { display: block; font-size: 14px; font-weight: 600; color: #92400e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-item-info span { font-size: 11px; color: #b45309; }
.trash-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-restore {
  padding: 5px 10px; background: #1a56db; color: #fff; border: none;
  border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: background .15s;
}
.btn-restore:hover { background: #1e40af; }
.btn-hard-delete {
  padding: 5px 10px; background: none; color: #ef4444; border: 1.5px solid #fca5a5;
  border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all .15s;
}
.btn-hard-delete:hover { background: #fef2f2; border-color: #ef4444; }
.trash-empty { text-align: center; padding: 16px; color: #94a3b8; font-size: 13px; }

/* ============================================================
   HEADER BUTTON GROUPS
   ============================================================ */
.header-btn-group { display: flex; align-items: center; gap: 4px; }
.header-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

/* ============================================================
   LANGUAGE SELECTOR
   ============================================================ */
.lang-selector { position: relative; }
.lang-btn { font-size: 18px !important; padding: 4px 8px !important; }
.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  padding: 4px;
  z-index: 200;
  animation: ctx-in .12s ease-out;
}
.lang-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  transition: background .1s;
}
.lang-option:hover { background: var(--bg); }
.lang-option.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ============================================================
   WISH TOOLTIPS (data-tooltip)
   ============================================================ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  text-transform: none;
  letter-spacing: 0;
}
[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1e293b;
  z-index: 1000;
  pointer-events: none;
}

/* ============================================================
   VALIDATION MODAL
   ============================================================ */
.validate-score {
  text-align: center;
  margin-bottom: 20px;
}
.validate-score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  border: 4px solid;
}
.validate-score-circle.good { border-color: var(--success); background: #ecfdf5; }
.validate-score-circle.ok { border-color: var(--accent); background: #fffbeb; }
.validate-score-circle.bad { border-color: var(--danger); background: #fef2f2; }
.score-num { font-size: 24px; font-weight: 800; color: var(--text); }
.validate-score-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.validate-all-good {
  text-align: center;
  padding: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}
.validate-category { margin-bottom: 12px; }
.validate-cat-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.validate-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}
.validate-item.passed { background: #f0fdf4; color: #166534; }
.validate-item.warning { background: #fffbeb; color: #92400e; }
.validate-item.failed { background: #fef2f2; color: #991b1b; }
.validate-status { font-size: 14px; flex-shrink: 0; }

/* ============================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================ */
.shortcuts-list { display: flex; flex-direction: column; gap: 8px; }
.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 13px;
}
.shortcut-item span { color: var(--text-muted); }
kbd {
  display: inline-block;
  padding: 2px 7px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
  margin: 0 2px;
}

/* ============================================================
   DRAG-AND-DROP FEEDBACK
   ============================================================ */
.palette-item.dragging {
  opacity: .5;
  transform: scale(.95);
}
#canvas-container.drag-over-canvas {
  outline: 3px dashed var(--primary);
  outline-offset: -3px;
}

/* ============================================================
   ROOM VISUALIZATION ON CANVAS (colored zones)
   ============================================================ */
.room-zone-label {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* ============================================================
   ONBOARDING WIZARD (multi-slide)
   ============================================================ */
.onboarding-slide {
  animation: modal-in .2s ease-out;
}
.onboarding-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.onboarding-dots {
  display: flex;
  gap: 8px;
}
.onboarding-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s;
  cursor: pointer;
}
.onboarding-dots .dot.active {
  background: var(--primary);
}
.onboarding-buttons {
  display: flex;
  gap: 8px;
}

/* ============================================================
   CHAT POPUP – Apple Liquid Glass
   ============================================================ */
.chat-popup {
  position: fixed;
  top: 60px;
  right: 120px;
  width: 370px;
  height: 500px;
  display: flex;
  flex-direction: column;
  /* Liquid Glass: layered translucency with specular highlight */
  background:
    linear-gradient(165deg, rgba(255,255,255,.82) 0%, rgba(245,248,255,.72) 40%, rgba(235,242,255,.68) 100%);
  backdrop-filter: blur(40px) saturate(220%) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(220%) brightness(1.08);
  /* Liquid Glass: refractive edge border + specular rim light */
  border: 1px solid rgba(255,255,255,.55);
  border-top: 1px solid rgba(255,255,255,.8);
  border-radius: 18px;
  /* Liquid Glass: multi-layer shadow for depth + inner glow */
  box-shadow:
    0 0 0 .5px rgba(255,255,255,.5),
    0 8px 40px rgba(0,0,0,.14),
    0 2px 12px rgba(0,0,0,.07),
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -1px 0 rgba(0,0,0,.03);
  z-index: 8500;
  overflow: hidden;
  transform-origin: top right;
}
.chat-popup.is-open {
  animation: chat-pop-in .3s cubic-bezier(.22,1,.36,1) forwards;
}
.chat-popup.is-closing {
  animation: chat-pop-out .2s cubic-bezier(.4,0,1,1) forwards;
}
@keyframes chat-pop-in {
  from { opacity: 0; transform: scale(.9) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes chat-pop-out {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(.92) translateY(-6px); }
}
/* Header: frosted glass gradient instead of solid blue */
.chat-popup-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(26,86,219,.92) 0%, rgba(37,99,235,.85) 100%);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.chat-popup-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 1px 3px rgba(0,0,0,.15);
}
.chat-popup-title-block { flex: 1; min-width: 0; }
.chat-popup-title { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.chat-popup-status { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 1px; }
.chat-popup-close {
  background: rgba(255,255,255,.12); border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: rgba(255,255,255,.9);
  transition: all .15s; flex-shrink: 0;
  backdrop-filter: blur(4px);
}
.chat-popup-close:hover { background: rgba(255,255,255,.25); transform: scale(1.05); }
/* Messages area: subtle glass background */
.chat-messages-list {
  flex: 1; overflow-y: auto; padding: 16px 14px 10px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
  background: rgba(248,250,255,.4);
}
.chat-messages-list::-webkit-scrollbar { width: 4px; }
.chat-messages-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 4px; }
/* Individual messages */
.chat-msg { display: flex; flex-direction: column; max-width: 82%; animation: msg-in .22s ease-out; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-msg.own { align-self: flex-end; align-items: flex-end; }
.chat-msg.other { align-self: flex-start; align-items: flex-start; }
.chat-msg-sender { font-size: 11px; font-weight: 600; margin-bottom: 3px; color: #8896ab; }
.chat-msg.own .chat-msg-sender { color: #6b8fd4; }
.chat-msg-bubble {
  padding: 9px 14px; border-radius: 16px;
  font-size: 13.5px; line-height: 1.45; word-break: break-word;
}
.chat-msg.own .chat-msg-bubble {
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 6px rgba(26,86,219,.3);
}
.chat-msg.other .chat-msg-bubble {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  color: #1e293b;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 1px 4px rgba(0,0,0,.05), inset 0 1px 0 rgba(255,255,255,.8);
}
.chat-msg-time { font-size: 10px; color: #a0aec0; margin-top: 3px; padding: 0 4px; }
/* Empty state */
.chat-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: #a0aec0; font-size: 13px; text-align: center; padding: 20px;
}
.chat-empty-state svg { opacity: .25; }
/* Input area: frosted glass bar */
.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,.5);
  flex-shrink: 0;
}
.chat-input-field {
  flex: 1; border: 1.5px solid rgba(0,0,0,.08); border-radius: 22px;
  padding: 9px 16px; font-size: 13px; background: rgba(255,255,255,.8);
  backdrop-filter: blur(4px);
  outline: none; transition: all .2s; font-family: inherit;
}
.chat-input-field:focus {
  border-color: rgba(26,86,219,.4);
  box-shadow: 0 0 0 3px rgba(26,86,219,.08);
  background: rgba(255,255,255,.95);
}
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  border: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: #fff;
  transition: all .15s;
  box-shadow: 0 2px 8px rgba(26,86,219,.3);
}
.chat-send-btn:hover { transform: scale(1.06); box-shadow: 0 3px 12px rgba(26,86,219,.4); }
.chat-send-btn:active { transform: scale(.94); }
.btn-chat-trigger { position: relative; }
