/*
  Smart Tools UI — variante scura condivisa
  Versione: 2026.07.025

  Questo foglio contiene soltanto gli override del tema scuro comune.
  Viene caricato dopo smart-tools-theme.css e si attiva tramite:

      <html data-ui-theme="dark">

  Può essere pubblicato su un dominio centralizzato insieme al tema chiaro.
*/

html[data-ui-theme="dark"] {
  color-scheme: dark;

  --bg: #07111f;
  --card: #0f1b2d;
  --text: #e7edf7;
  --muted: #9eacc0;
  --border: #2a3a50;
  --border-soft: #203047;
  --accent: #60a5fa;
  --accent-2: #3b82f6;
  --accent-soft: #152b47;
  --warning-bg: #332611;
  --warning-border: #6b4e1d;
  --warning-text: #f5cf79;
  --danger: #fb7185;
  --success: #4ade80;

  --surface: var(--card);
  --surface-2: #132238;
  --border-strong: #3b506c;
  --primary: var(--accent);
  --primary-hover: #93c5fd;
  --shadow: 0 18px 44px rgba(0, 0, 0, .34);
}

html[data-ui-theme="dark"] body.smarttools-ui {
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 18% -4%, rgba(37, 99, 235, .24) 0%, transparent 58%),
    radial-gradient(900px 520px at 100% 18%, rgba(79, 70, 229, .19) 0%, transparent 55%),
    linear-gradient(180deg, #081321 0%, var(--bg) 100%);
}

/* ===== Header e controllo aspetto ===== */
html[data-ui-theme="dark"] body.smarttools-ui .app-header {
  border-color: rgba(55, 75, 101, .88);
  background: rgba(13, 27, 45, .86);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255,255,255,.035);
}

html[data-ui-theme="dark"] body.smarttools-ui .brand-mark {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.20), 0 8px 22px rgba(37, 99, 235, .30);
}

html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-toggle {
  border-color: var(--border-soft);
  background: rgba(17, 31, 50, .86);
}

html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button {
  color: #aebdd0;
}

html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button:hover {
  border-color: #33445c;
  background: #142238;
  color: #f8fafc;
}

html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button.active,
html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button[aria-pressed="true"] {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .32);
}

html[data-ui-theme="dark"] body.smarttools-ui .badge {
  border-color: #285c3d;
  background: rgba(20, 70, 43, .48);
  color: #86efac;
}

html[data-ui-theme="dark"] body.smarttools-ui .badge.neutral {
  border-color: var(--border-soft);
  background: rgba(19, 34, 56, .9);
  color: var(--muted);
}

/* ===== Hero comune dei tool ===== */
html[data-ui-theme="dark"] body.smarttools-ui .tool-hero {
  border-color: rgba(96, 165, 250, .28);
  background: linear-gradient(135deg, #174ea6 0%, #1d4ed8 52%, #3730a3 100%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255,255,255,.10);
}

html[data-ui-theme="dark"] body.smarttools-ui .tool-hero::before {
  background: rgba(147, 197, 253, .15);
}

html[data-ui-theme="dark"] body.smarttools-ui .tool-hero::after {
  border-color: rgba(191, 219, 254, .16);
  background: rgba(147, 197, 253, .06);
}

/* ===== Pannelli, barre e splitter ===== */
html[data-ui-theme="dark"] body.smarttools-ui .panel {
  border-color: rgba(55, 75, 101, .90);
  background: rgba(14, 27, 45, .91);
  box-shadow: var(--shadow);
}

html[data-ui-theme="dark"] body.smarttools-ui .panel-toolbar {
  border-bottom-color: var(--border-soft);
  background: linear-gradient(180deg, rgba(20, 42, 70, .88) 0%, rgba(14, 27, 45, .96) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

html[data-ui-theme="dark"] body.smarttools-ui .editor-meta,
html[data-ui-theme="dark"] body.smarttools-ui .editor-footer,
html[data-ui-theme="dark"] body.smarttools-ui .status-bar,
html[data-ui-theme="dark"] body.smarttools-ui .icon-result-info,
html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-status {
  border-color: var(--border-soft);
  background: rgba(15, 29, 48, .94);
  color: var(--muted);
}

html[data-ui-theme="dark"] body.smarttools-ui .divider::before {
  background: rgba(78, 101, 132, .72);
}

html[data-ui-theme="dark"] body.smarttools-ui .divider-handle {
  border-color: #48617f;
  background: rgba(14, 27, 45, .98);
  color: #7db7ff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255,255,255,.04);
}

html[data-ui-theme="dark"] body.smarttools-ui .divider:hover .divider-handle,
html[data-ui-theme="dark"] body.smarttools-ui .divider.dragging .divider-handle,
html[data-ui-theme="dark"] body.smarttools-ui .divider:focus-visible .divider-handle {
  border-color: #60a5fa;
  background: #162b46;
  color: #bfdbfe;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .26);
}

/* ===== Pulsanti, select e campi ===== */
html[data-ui-theme="dark"] body.smarttools-ui .button,
html[data-ui-theme="dark"] body.smarttools-ui .icon-button,
html[data-ui-theme="dark"] body.smarttools-ui .select {
  border-color: var(--border-soft);
  background: #111f32;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.025);
}

html[data-ui-theme="dark"] body.smarttools-ui .select option {
  background: #111f32;
  color: var(--text);
}

html[data-ui-theme="dark"] body.smarttools-ui .button:hover,
html[data-ui-theme="dark"] body.smarttools-ui .icon-button:hover,
html[data-ui-theme="dark"] body.smarttools-ui .select:hover {
  border-color: #4f7eb8;
  background: var(--accent-soft);
  color: #bfdbfe;
}

html[data-ui-theme="dark"] body.smarttools-ui .button:focus-visible,
html[data-ui-theme="dark"] body.smarttools-ui .icon-button:focus-visible,
html[data-ui-theme="dark"] body.smarttools-ui .select:focus-visible,
html[data-ui-theme="dark"] body.smarttools-ui input:focus-visible,
html[data-ui-theme="dark"] body.smarttools-ui textarea:focus-visible {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .25);
}

html[data-ui-theme="dark"] body.smarttools-ui .button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 20px rgba(37, 99, 235, .26);
}

html[data-ui-theme="dark"] body.smarttools-ui .button.primary:hover {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
}

html[data-ui-theme="dark"] body.smarttools-ui .button.ghost {
  background: rgba(17, 31, 50, .70);
}

html[data-ui-theme="dark"] body.smarttools-ui .button.danger-soft {
  border-color: #713744;
  background: #321d28;
  color: #fda4af;
}

html[data-ui-theme="dark"] body.smarttools-ui .button.danger-soft:hover {
  border-color: #9f4c5d;
  background: #442330;
  color: #fecdd3;
}

/* ===== Anteprima, editor e messaggi ===== */
html[data-ui-theme="dark"] body.smarttools-ui .preview-viewport,
html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-box {
  background: rgba(7, 17, 31, .94);
}

html[data-ui-theme="dark"] body.smarttools-ui .preview-grid {
  opacity: .38;
  background-image:
    linear-gradient(to right, rgba(117, 153, 199, .105) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(117, 153, 199, .105) 1px, transparent 1px),
    linear-gradient(to right, rgba(117, 153, 199, .052) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(117, 153, 199, .052) 1px, transparent 1px);
}

html[data-ui-theme="dark"] body.smarttools-ui .viewport-hint {
  border-color: rgba(55, 75, 101, .92);
  background: rgba(13, 27, 45, .88);
  color: var(--muted);
  box-shadow: 0 7px 20px rgba(0,0,0,.22);
}

html[data-ui-theme="dark"] body.smarttools-ui .error-box {
  border-color: #703947;
  background: #321d27;
  color: #fda4af;
}

html[data-ui-theme="dark"] body.smarttools-ui .error-hint {
  color: #fda4af;
}

/* ===== Dialog, modali e configurazioni ===== */
html[data-ui-theme="dark"] body.smarttools-ui .help-dialog {
  border-color: rgba(55, 75, 101, .96);
  background: rgba(13, 25, 42, .99);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .58);
}

html[data-ui-theme="dark"] body.smarttools-ui .help-dialog::backdrop {
  background: rgba(1, 6, 15, .72);
}

html[data-ui-theme="dark"] body.smarttools-ui .dialog-header,
html[data-ui-theme="dark"] body.smarttools-ui .dialog-footer,
html[data-ui-theme="dark"] body.smarttools-ui .examples-toolbar,
html[data-ui-theme="dark"] body.smarttools-ui .icon-operation-bar {
  border-color: var(--border-soft);
  background: rgba(15, 29, 48, .94);
}

html[data-ui-theme="dark"] body.smarttools-ui .dialog-body p,
html[data-ui-theme="dark"] body.smarttools-ui .dialog-subtitle {
  color: var(--muted);
}

html[data-ui-theme="dark"] body.smarttools-ui .dialog-body code {
  background: var(--accent-soft);
  color: #bfdbfe;
}

html[data-ui-theme="dark"] body.smarttools-ui .dialog-body pre {
  border-color: var(--border-soft);
  background: #101d30;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-search,
html[data-ui-theme="dark"] body.smarttools-ui .config-field input,
html[data-ui-theme="dark"] body.smarttools-ui .config-field textarea,
html[data-ui-theme="dark"] body.smarttools-ui .config-field select {
  border-color: var(--border-soft);
  background: #111f32;
  color: var(--text);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-search:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .22);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-config,
html[data-ui-theme="dark"] body.smarttools-ui .examples-list-panel {
  border-color: var(--border-soft);
  background: #101d30;
}

html[data-ui-theme="dark"] body.smarttools-ui .selected-icon-card,
html[data-ui-theme="dark"] body.smarttools-ui .selected-icon-preview,
html[data-ui-theme="dark"] body.smarttools-ui .icon-section,
html[data-ui-theme="dark"] body.smarttools-ui .icon-layout-note,
html[data-ui-theme="dark"] body.smarttools-ui .icon-validation,
html[data-ui-theme="dark"] body.smarttools-ui .icon-operation-hint,
html[data-ui-theme="dark"] body.smarttools-ui .icon-locked-note {
  border-color: var(--border-soft);
  background: #111f32;
  color: var(--muted);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-context {
  border-color: #3e5571;
  background: #14243a;
  color: #c7d5e8;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-layout-note,
html[data-ui-theme="dark"] body.smarttools-ui .icon-locked-note {
  border-left-color: #52739b;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-validation.checking,
html[data-ui-theme="dark"] body.smarttools-ui .icon-operation-hint.detected {
  border-color: #355f8b;
  background: #142c47;
  color: #bfdbfe;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-validation.ok,
html[data-ui-theme="dark"] body.smarttools-ui .icon-operation-hint.editing,
html[data-ui-theme="dark"] body.smarttools-ui .icon-compatibility.ok {
  border-color: #2f6644;
  background: #153524;
  color: #bbf7d0;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-validation.error {
  border-color: #74404c;
  background: #351f29;
  color: #fecdd3;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-compatibility.warning {
  border-color: #6a572b;
  background: #352b16;
  color: #fde68a;
}

/* ===== Catalogo icone ===== */
html[data-ui-theme="dark"] body.smarttools-ui .icon-tile {
  border-color: var(--border-soft);
  background: #111f32;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.20);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-tile:hover,
html[data-ui-theme="dark"] body.smarttools-ui .icon-tile:focus-visible {
  border-color: #4f7eb8;
  background: #18304e;
  color: #dbeafe;
  box-shadow: 0 9px 22px rgba(0,0,0,.24), 0 0 0 1px rgba(96, 165, 250, .08);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.selected,
html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.selected:hover,
html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.selected:focus-visible {
  border-color: #60a5fa;
  background: #1c3a60;
  color: #eff6ff;
  box-shadow: 0 0 0 2px rgba(96,165,250,.20), 0 8px 20px rgba(0,0,0,.24);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.mermaid-icon {
  background: linear-gradient(180deg, #14263e, #101d30);
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.mermaid-icon small {
  color: #d8b4fe;
}

html[data-ui-theme="dark"] body.smarttools-ui .icon-tile.incompatible:hover {
  border-color: var(--border-soft);
  background: #111f32;
}

/* ===== Catalogo esempi ===== */
html[data-ui-theme="dark"] body.smarttools-ui .example-card {
  border-color: var(--border-soft);
  background: #111f32;
  color: var(--text);
}

html[data-ui-theme="dark"] body.smarttools-ui .example-card:hover {
  border-color: #4f7eb8;
  background: #18304e;
  box-shadow: 0 7px 18px rgba(0,0,0,.22);
}

html[data-ui-theme="dark"] body.smarttools-ui .example-card.selected {
  border-color: #60a5fa;
  background: #1c3a60;
  box-shadow: 0 0 0 2px rgba(96,165,250,.17);
}

html[data-ui-theme="dark"] body.smarttools-ui .example-card-category,
html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-head code,
html[data-ui-theme="dark"] body.smarttools-ui .examples-empty {
  border-color: var(--border-soft);
  background: #101d30;
  color: var(--muted);
}

html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-panel,
html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-head {
  border-color: var(--border-soft);
  background: #0f1b2d;
}

html[data-ui-theme="dark"] body.smarttools-ui .examples-preview-error {
  border-color: #74404c;
  background: #351f29;
  color: #fecdd3;
}

/* ===== Menu esportazione ===== */
html[data-ui-theme="dark"] body.smarttools-ui .export-menu-panel {
  border-color: rgba(55, 75, 101, .98);
  background: rgba(13, 25, 42, .99);
  box-shadow: 0 24px 62px rgba(0,0,0,.54);
}

html[data-ui-theme="dark"] body.smarttools-ui .export-menu-item {
  color: var(--text);
}

html[data-ui-theme="dark"] body.smarttools-ui .export-menu-item:hover,
html[data-ui-theme="dark"] body.smarttools-ui .export-menu-item:focus-visible {
  border-color: #4f7eb8;
  background: #18304e;
  color: #dbeafe;
}

html[data-ui-theme="dark"] body.smarttools-ui .export-menu-setting {
  border-color: var(--border-soft);
  background: #101d30;
}

/* ===== Footer, toast e scrollbar ===== */
html[data-ui-theme="dark"] body.smarttools-ui .app-footer {
  border-color: rgba(42, 58, 80, .94);
  background: rgba(13, 27, 45, .84);
  color: var(--muted);
  box-shadow: 0 10px 26px rgba(0,0,0,.20);
}

html[data-ui-theme="dark"] body.smarttools-ui .toast {
  border-color: rgba(96, 165, 250, .18);
  background: #dbeafe;
  color: #10213a;
  box-shadow: 0 18px 38px rgba(0,0,0,.40);
}

html[data-ui-theme="dark"] body.smarttools-ui * {
  scrollbar-color: #425a78 transparent;
}

html[data-ui-theme="dark"] body.smarttools-ui *::-webkit-scrollbar-thumb {
  background: #425a78;
  background-clip: padding-box;
}

html[data-ui-theme="dark"] body.smarttools-ui *::-webkit-scrollbar-thumb:hover {
  background-color: #5b7598;
}

@media (max-width: 720px) {
  html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button span { display: none; }
  html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-button { width: 32px; padding: 0; }
}

/* Pulsante unico per il cambio tema Light/Dark. */
html[data-ui-theme="dark"] body.smarttools-ui .ui-theme-toggle-single {
  min-height: 38px;
  border-color: #33445c;
}


/* Diagram Lab v2026.07.026 — drag & drop, tema scuro */
html[data-ui-theme="dark"] body.smarttools-ui .drop-hint {
  border-color: #365c88;
  background: rgba(16, 29, 48, .84);
  color: #9fb9d8;
}
html[data-ui-theme="dark"] body.smarttools-ui .file-drop-overlay {
  border-color: #60a5fa;
  background: rgba(8, 18, 32, .94);
  color: #bfdbfe;
}
html[data-ui-theme="dark"] body.smarttools-ui .file-drop-card {
  border-color: rgba(96, 165, 250, .44);
  background: rgba(17, 31, 50, .97);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .52);
}
html[data-ui-theme="dark"] body.smarttools-ui .editor-panel.file-drag-active {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .22), var(--shadow);
}
