/* ============================================================
 * SVG Builder – záložky, kompaktní color rows, picker popover
 * ============================================================ */

/* Builder button v inputu colors */
.svgb-input-parent { position: relative; }
.svgb-input-parent > input[type="text"],
.svgb-input-parent > input:not([type]) { padding-right: 36px !important; }
.svgb-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: #4990e2;
  border: 1px solid transparent; border-radius: 4px;
  cursor: pointer; line-height: 0; z-index: 2;
}
.svgb-btn:hover { background: rgba(73,144,226,0.12); border-color: #4990e2; }
.svgb-btn svg { display: block; }
html.dark .svgb-btn { color: #6ab0f3; }
html.dark .svgb-btn:hover { background: rgba(106,176,243,0.16); border-color: #6ab0f3; }

/* Modal */
.svg-builder-dialog { position: fixed; inset: 0; z-index: 2147483600; display: flex; align-items: center; justify-content: center; font-family: sans-serif; }
.svg-builder-dialog .backdrop-ux { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.svg-builder-dialog .modal-ux { position: relative; z-index: 1; width: 94%; max-width: 880px; max-height: 90vh; background: #fff; border: 1px solid #d9d9d9; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); display: flex; flex-direction: column; overflow: hidden; }
.svg-builder-dialog .modal-dialog-ux, .svg-builder-dialog .modal-ux-inner { display: flex; flex-direction: column; overflow: hidden; max-height: 100%; }
.svg-builder-dialog .modal-ux-header { flex: 0 0 auto; padding: 14px 20px; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: space-between; background: #f6f6f6; }
.svg-builder-dialog .modal-ux-header h3 { margin: 0; font-size: 16px; color: #3b4151; }
.svg-builder-dialog .modal-ux-header .close-modal { background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 2px 10px; font-size: 18px; cursor: pointer; color: #3b4151; }
.svg-builder-dialog .modal-ux-header .close-modal:hover { background: #fff; border-color: #d9d9d9; }
.svg-modal-content { padding: 16px 20px 16px; overflow-y: auto; flex: 1; }

/* Grid: left (tabs+colors) / right (preview+controls) */
.svg-builder-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; align-items: start; }
@media (max-width: 700px) { .svg-builder-grid { grid-template-columns: 1fr; } }

/* Tabs */
.svgb-tabs { display: flex; border-bottom: 2px solid #e0e0e0; margin-bottom: 12px; gap: 0; }
.svgb-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; color: #6b7280; transition: color 0.1s, border-color 0.1s;
}
.svgb-tab:hover { color: #3b4151; }
.svgb-tab.active { color: #4990e2; border-bottom-color: #4990e2; }

/* Compact color row */
.svgb-crow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid #f0f0f0;
  position: relative;
}
.svgb-crow:last-child { border-bottom: none; }
.svgb-crow-swatch {
  width: 26px; height: 26px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.12);
  cursor: pointer; flex: 0 0 auto; transition: box-shadow 0.1s;
}
.svgb-crow-swatch:hover { box-shadow: 0 0 0 3px rgba(73,144,226,0.3); }
.svgb-crow-label { flex: 1; font-size: 13px; color: #3b4151; }
.svgb-crow-hex {
  width: 80px; padding: 5px 7px; font-size: 13px; font-family: monospace;
  text-transform: uppercase; border: 1px solid #d9d9d9; border-radius: 4px;
  background: #fff; color: #3b4151; box-sizing: border-box; text-align: center;
}
.svgb-crow-hex:focus { outline: none; border-color: #4990e2; box-shadow: 0 0 0 2px rgba(73,144,226,0.2); }

/* Picker popover */
.svgb-popover {
  position: fixed; z-index: 2147483610;
  background: #fff; border: 1px solid #d9d9d9; border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  width: 300px;
}
.svgb-sv-wrap { position: relative; width: 100%; aspect-ratio: 1.4; cursor: crosshair; border-radius: 4px; overflow: hidden; touch-action: none; }
.svgb-sv { display: block; width: 100%; height: 100%; border-radius: 4px; }
.svgb-sv-cursor { position: absolute; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 2px rgba(0,0,0,0.6); pointer-events: none; transform: translate(-50%,-50%); }
.svgb-hue-wrap { position: relative; width: 100%; height: 14px; cursor: pointer; border-radius: 7px; overflow: hidden; touch-action: none; }
.svgb-hue { display: block; width: 100%; height: 100%; border-radius: 7px; }
.svgb-hue-cursor { position: absolute; top: -2px; width: 6px; height: 18px; border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 2px rgba(0,0,0,0.5); pointer-events: none; transform: translateX(-50%); }
.svgb-inputs { display: flex; align-items: flex-end; gap: 6px; }
.svgb-swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.12); flex: 0 0 auto; }
.svgb-input-group { display: flex; flex-direction: column; gap: 2px; }
.svgb-input-label { font-size: 10px; font-weight: 600; color: #6b7280; text-transform: uppercase; }
.svgb-hex { width: 72px; padding: 5px 5px; font-size: 12px; font-family: monospace; text-transform: uppercase; border: 1px solid #d9d9d9; border-radius: 3px; background: #fff; color: #3b4151; box-sizing: border-box; }
.svgb-hex:focus { outline: none; border-color: #4990e2; box-shadow: 0 0 0 2px rgba(73,144,226,0.2); }
.svgb-rgb { width: 44px; padding: 5px 3px; font-size: 12px; border: 1px solid #d9d9d9; border-radius: 3px; background: #fff; color: #3b4151; box-sizing: border-box; text-align: center; }
.svgb-rgb:focus { outline: none; border-color: #4990e2; box-shadow: 0 0 0 2px rgba(73,144,226,0.2); }
.svgb-rgb::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.svgb-rgb { -moz-appearance: textfield; }

/* Preview pane */
.svg-builder-preview-pane { display: flex; flex-direction: column; min-width: 0; gap: 0; }
.svg-section-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: #3b4151; letter-spacing: 0.04em; text-transform: uppercase; }

/* Info ikonka s tooltipem (analogicky jako .rql-info) */
.svgb-info {
  display: inline-block; margin-left: 4px; color: #a0a8b2;
  font-size: 13px; cursor: help; text-transform: none; letter-spacing: 0;
  line-height: 1; vertical-align: middle; user-select: none;
}
.svgb-info:hover, .svgb-info:focus { color: #4990e2; outline: none; }
html.dark .svgb-info { color: #666; }
html.dark .svgb-info:hover, html.dark .svgb-info:focus { color: #6ab0f3; }
.svg-builder-preview-box { padding: 16px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: auto; }

/* Controls — cards with spacing */
.svgb-preview-wrap { position: relative; margin-bottom: 14px; }
.svgb-bg-btn {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 26px; height: 26px; padding: 0;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 4px;
  cursor: pointer; background: rgba(0,0,0,0.35); color: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.svgb-bg-btn:hover { background: rgba(0,0,0,0.6); color: #fff; border-color: rgba(255,255,255,0.5); }
.svgb-bg-btn svg { display: block; }
.svgb-control-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.svgb-control-label { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.svgb-icons-label { display: block; margin-top: 20px; margin-bottom: 8px; }
.svgb-severity-btns { display: flex; gap: 5px; }
.svgb-sev-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0.4; transition: opacity 0.15s, border-color 0.15s, transform 0.1s; }
.svgb-sev-btn:hover { opacity: 0.75; transform: scale(1.1); }
.svgb-sev-btn.active { opacity: 1; border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.3); transform: scale(1.15); }

/* Icon toggles — single column, more space */
.svgb-icons-grid { display: flex; flex-direction: column; gap: 8px; }
.svgb-icon-row { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12px; color: #3b4151; }
.svgb-icon-cb { position: absolute; opacity: 0; width: 0; height: 0; }
.svgb-icon-slider { position: relative; display: inline-block; width: 30px; height: 16px; background: #c4c9d4; border-radius: 999px; transition: background 0.15s; flex: 0 0 auto; }
.svgb-icon-slider::after { content:""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.15s; }
.svgb-icon-cb:checked + .svgb-icon-slider { background: #4990e2; }
.svgb-icon-cb:checked + .svgb-icon-slider::after { transform: translateX(14px); }
.svgb-icon-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.svgb-icon-name { flex: 1; }
.svg-builder-preview-note { margin-top: 20px; font-size: 10px; font-style: italic; color: #6b7280; line-height: 1.4; text-align: center; }

/* Footer */
.svg-modal-footer { display: flex; align-items: center; gap: 10px; padding: 14px 0 4px; margin-top: 12px; border-top: 1px solid #e0e0e0; }
.svg-footer-spacer { flex: 1; }
.svg-modal-footer button { padding: 7px 16px; font-size: 13px; font-weight: 600; border-radius: 4px; cursor: pointer; font-family: inherit; }
.svg-reset, .svg-cancel { background: transparent; color: #3b4151; border: 1px solid #d9d9d9; }
.svg-reset:hover, .svg-cancel:hover { background: #f6f6f6; }
.svg-apply { background: #4990e2; color: #fff; border: 1px solid #4990e2; }
.svg-apply:hover { background: #357abd; border-color: #357abd; }

/* ============================================================ Dark mode */
html.dark .svg-builder-dialog .modal-ux { background: #252525; border-color: #444; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
html.dark .svg-builder-dialog .modal-ux-header { background: #1f1f1f; border-bottom-color: #444; }
html.dark .svg-builder-dialog .modal-ux-header h3, html.dark .svg-builder-dialog .modal-ux-header .close-modal { color: #e0e0e0; }
html.dark .svg-builder-dialog .modal-ux-header .close-modal:hover { background: #2a2a2a; border-color: #555; }
html.dark .svgb-tabs { border-bottom-color: #444; }
html.dark .svgb-tab { color: #9aa3b1; }
html.dark .svgb-tab:hover { color: #e0e0e0; }
html.dark .svgb-tab.active { color: #6ab0f3; border-bottom-color: #6ab0f3; }
html.dark .svgb-crow { border-bottom-color: #333; }
html.dark .svgb-crow-label, html.dark .svgb-icon-row, html.dark .svgb-control-label { color: #e0e0e0; }
html.dark .svgb-crow-hex { background: #1e1e1e; color: #e8e8e8; border-color: #444; }
html.dark .svgb-crow-hex:focus { border-color: #6ab0f3; box-shadow: 0 0 0 2px rgba(106,176,243,0.25); }
html.dark .svgb-popover { background: #2a2a2a; border-color: #555; box-shadow: 0 8px 30px rgba(0,0,0,0.5); }
html.dark .svgb-hex, html.dark .svgb-rgb { background: #1e1e1e; color: #e8e8e8; border-color: #444; }
html.dark .svgb-hex:focus, html.dark .svgb-rgb:focus { border-color: #6ab0f3; box-shadow: 0 0 0 2px rgba(106,176,243,0.25); }
html.dark .svgb-input-label { color: #9aa3b1; }
html.dark .svg-section-title { color: #e0e0e0; }
html.dark .svg-builder-preview-box { background: #1e2536; border-color: #2c3450; }
html.dark .svg-builder-preview-note { color: #9aa3b1; }
html.dark .svgb-icon-slider { background: #555; }
html.dark .svgb-icon-cb:checked + .svgb-icon-slider { background: #4a76a8; }
html.dark .svg-modal-footer { border-top-color: #444; }
html.dark .svg-reset, html.dark .svg-cancel { color: #e0e0e0; border-color: #555; }
html.dark .svg-reset:hover, html.dark .svg-cancel:hover { background: #2a2a2a; }
html.dark .svg-apply { background: #355a87; border-color: #4a76a8; color: #e6f0ff; }
html.dark .svg-apply:hover { background: #4a76a8; border-color: #6ab0f3; }
