/**
 * Tema Maestro - dia/noite/sistema
 * Variáveis CSS compartilhadas entre landing e app
 */
:root {
  --maestro-accent: #00d4aa;
  --maestro-accent-hover: #00ffcc;
  --maestro-accent-dim: #00a884;
}

/* Aliases para landing e app */
:root, [data-theme] {
  --bg: var(--maestro-bg);
  --bg-elevated: var(--maestro-bg-elevated);
  --accent: var(--maestro-accent);
  --accent-dim: var(--maestro-accent-dim);
  --text: var(--maestro-text);
  --text-muted: var(--maestro-text-muted);
  --border: var(--maestro-border);
}

/* Aplica tema em body e Bootstrap */
body {
  background-color: var(--maestro-bg) !important;
  color: var(--maestro-text) !important;
}
.text-muted { color: var(--maestro-text-muted) !important; }
.form-control, .form-select {
  background-color: var(--maestro-input-bg) !important;
  border-color: var(--maestro-input-border) !important;
  color: var(--maestro-text) !important;
}
.modal-content {
  background-color: var(--maestro-modal-bg) !important;
  border-color: var(--maestro-border) !important;
}
.modal-header, .modal-footer { border-color: var(--maestro-border) !important; }
.modal-title { color: var(--maestro-text) !important; }
.list-group-item {
  background-color: var(--maestro-bg-elevated) !important;
  border-color: var(--maestro-border) !important;
  color: var(--maestro-text) !important;
}
.card {
  background-color: var(--maestro-bg-card) !important;
  border-color: var(--maestro-border) !important;
}
.card-body { color: var(--maestro-text) !important; }
.table {
  --bs-table-bg: var(--maestro-bg-elevated) !important;
  --bs-table-color: var(--maestro-text) !important;
  --bs-table-border-color: var(--maestro-border) !important;
}
.table > :not(caption) > * > * {
  background-color: var(--maestro-bg-elevated) !important;
  color: var(--maestro-text) !important;
  border-color: var(--maestro-border) !important;
}
.btn-primary {
  background-color: var(--maestro-accent) !important;
  border-color: var(--maestro-accent) !important;
  color: #0a0a0f !important;
}
.btn-primary:hover {
  background-color: var(--maestro-accent-hover) !important;
  border-color: var(--maestro-accent-hover) !important;
  color: #0a0a0f !important;
}
.btn-outline-secondary {
  border-color: var(--maestro-border) !important;
  color: var(--maestro-text) !important;
}
.btn-outline-secondary:hover {
  background-color: var(--maestro-nav-hover) !important;
  border-color: var(--maestro-accent) !important;
  color: var(--maestro-accent) !important;
}
.bg-light { background-color: var(--maestro-bg-elevated) !important; }
.bg-white { background-color: var(--maestro-bg-card) !important; }

/* Light (padrão - tema dia) */
:root {
  --maestro-bg: #f5f5f7;
  --maestro-bg-elevated: #ffffff;
  --maestro-bg-card: #ffffff;
  --maestro-text: #1a1a1f;
  --maestro-text-muted: #6b6b7b;
  --maestro-border: rgba(0,0,0,0.08);
  --maestro-sidebar-bg: #ffffff;
  --maestro-sidebar-border: rgba(0,0,0,0.08);
  --maestro-nav-hover: rgba(0,0,0,0.05);
  --maestro-nav-active: rgba(0,212,170,0.15);
  --maestro-modal-bg: #ffffff;
  --maestro-input-bg: #ffffff;
  --maestro-input-border: rgba(0,0,0,0.15);
}

/* Light */
[data-theme="light"] {
  --maestro-bg: #f5f5f7;
  --maestro-bg-elevated: #ffffff;
  --maestro-bg-card: #ffffff;
  --maestro-text: #1a1a1f;
  --maestro-text-muted: #6b6b7b;
  --maestro-border: rgba(0,0,0,0.08);
  --maestro-sidebar-bg: #ffffff;
  --maestro-sidebar-border: rgba(0,0,0,0.08);
  --maestro-nav-hover: rgba(0,0,0,0.05);
  --maestro-nav-active: rgba(0,212,170,0.15);
  --maestro-modal-bg: #ffffff;
  --maestro-input-bg: #ffffff;
  --maestro-input-border: rgba(0,0,0,0.15);
}

/* Dark (override explícito) */
[data-theme="dark"] {
  --maestro-bg: #0a0a0f;
  --maestro-bg-elevated: #12121a;
  --maestro-bg-card: #1a1a1f;
  --maestro-text: #f0f0f5;
  --maestro-text-muted: #8888a0;
  --maestro-border: rgba(255,255,255,0.06);
  --maestro-sidebar-bg: #12121a;
  --maestro-sidebar-border: rgba(255,255,255,0.08);
  --maestro-nav-hover: rgba(255,255,255,0.08);
  --maestro-nav-active: rgba(0,212,170,0.2);
  --maestro-modal-bg: #1a1a1f;
  --maestro-input-bg: #12121a;
  --maestro-input-border: rgba(255,255,255,0.15);
}

/* System - usa preferência do SO */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --maestro-bg: #f5f5f7;
    --maestro-bg-elevated: #ffffff;
    --maestro-bg-card: #ffffff;
    --maestro-text: #1a1a1f;
    --maestro-text-muted: #6b6b7b;
    --maestro-border: rgba(0,0,0,0.08);
    --maestro-sidebar-bg: #ffffff;
    --maestro-sidebar-border: rgba(0,0,0,0.08);
    --maestro-nav-hover: rgba(0,0,0,0.05);
    --maestro-nav-active: rgba(0,212,170,0.15);
    --maestro-modal-bg: #ffffff;
    --maestro-input-bg: #ffffff;
    --maestro-input-border: rgba(0,0,0,0.15);
  }
}
/* Git config modal layout */
.git-config-modal-layout {
  min-height: 400px;
}
.git-config-modal-left {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--maestro-border);
}
.git-config-modal-right {
  flex: 1;
  min-width: 0;
}
.git-modal-files-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--maestro-border);
  border-radius: 6px;
  background: rgba(0,0,0,0.15);
}
.git-modal-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: Consolas, Monaco, monospace;
  cursor: pointer;
  border-bottom: 1px solid var(--maestro-border);
  color: var(--maestro-text);
}
.git-modal-file-item:last-child { border-bottom: none; }
.git-modal-file-item:hover { background: var(--maestro-nav-hover); }
.git-modal-file-item-ativo {
  background: var(--maestro-accent);
  color: #0a0a0f;
}
.git-modal-diff-content {
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  background: #1e1e1e;
  border-radius: 6px;
  border: 1px solid var(--maestro-border);
}
.git-diff-empty { color: var(--maestro-text-muted); }
.git-diff-line {
  white-space: pre;
  word-break: break-all;
  padding: 0 8px;
  margin: 0 -8px;
  font-size: 12px;
  line-height: 1.5;
}
.git-diff-hunk { color: #569cd6; background: rgba(86,156,214,0.12); font-weight: 500; }
.git-diff-add { color: #4ec9b0; background: rgba(110,184,90,0.18); }
.git-diff-del { color: #f48771; background: rgba(255,100,100,0.15); }
.git-diff-ctx { color: #d4d4d4; }
.git-change-item-ativo { background: var(--maestro-accent) !important; color: #0a0a0f !important; }

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --maestro-bg: #0a0a0f;
    --maestro-bg-elevated: #12121a;
    --maestro-bg-card: #1a1a1f;
    --maestro-text: #f0f0f5;
    --maestro-text-muted: #8888a0;
    --maestro-border: rgba(255,255,255,0.06);
    --maestro-sidebar-bg: #12121a;
    --maestro-sidebar-border: rgba(255,255,255,0.08);
    --maestro-nav-hover: rgba(255,255,255,0.08);
    --maestro-nav-active: rgba(0,212,170,0.2);
    --maestro-modal-bg: #1a1a1f;
    --maestro-input-bg: #12121a;
    --maestro-input-border: rgba(255,255,255,0.15);
  }
}
