/* ============================================================================
   Bubi2 — Command Palette · Dark Mode
   Navigare 100% din tastatură: stările :focus și .selected sunt evidențiate.
   ============================================================================ */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
  --success: #3fb950;
  --error: #f85149;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: radial-gradient(ellipse at 50% 0%, #131a24 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font);
}

.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Ecrane centrate perfect (Flexbox)
   -------------------------------------------------------------------------- */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 18vh;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 56px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.login-box .logo {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

.login-box p {
  color: var(--text-dim);
  margin-bottom: 28px;
}

/* --------------------------------------------------------------------------
   Butoane — focus foarte vizibil (esențial pentru tastatură)
   -------------------------------------------------------------------------- */
.btn-primary, .btn-secondary {
  font: inherit;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent);
}

/* --------------------------------------------------------------------------
   Command Palette
   -------------------------------------------------------------------------- */
.palette {
  width: min(640px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.palette-icon {
  color: var(--accent);
  font-size: 20px;
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  font-family: inherit;
}

#search-input:focus { outline: none; }

/* Inel de focus pe întreg header-ul când input-ul e activ */
.palette:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 24px 64px rgba(0, 0, 0, 0.55);
}

.user-badge {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Rezultate */
.results {
  list-style: none;
  max-height: 380px;
  overflow-y: auto;
}

.results li {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.results li .op-name { font-size: 15px; font-weight: 500; }
.results li .op-desc { font-size: 13px; color: var(--text-dim); }

/* Elementul selectat cu săgețile — echivalentul vizual al focus-ului */
.results li.selected {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.results li.selected .op-name { color: var(--accent); }

.results .empty {
  padding: 24px 20px;
  color: var(--text-dim);
  text-align: center;
  cursor: default;
}

/* Footer cu hint-uri de tastatură */
.palette-footer {
  display: flex;
  gap: 20px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 11px;
  margin: 0 2px;
}

/* --------------------------------------------------------------------------
   Dialog parametri (tag-ul <dialog>)
   -------------------------------------------------------------------------- */
dialog {
  margin: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  width: min(460px, 92vw);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

dialog h2 {
  font-size: 18px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  color: var(--text-dim);
}

.field label .req { color: var(--error); }

.field input, .field select {
  font: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

/* Focus foarte vizibil pe câmpuri — navigare cu Tab */
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input::-webkit-calendar-picker-indicator { filter: invert(0.8); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.dialog-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Status & rezultate JSON
   -------------------------------------------------------------------------- */
.status-bar {
  width: min(640px, 92vw);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.status-bar.ok    { border-color: var(--success); color: var(--success); }
.status-bar.err   { border-color: var(--error);   color: var(--error); }
.status-bar.busy  { border-color: var(--accent);  color: var(--accent); }

.json-result {
  width: min(640px, 92vw);
  max-height: 300px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}

/* Scrollbar discret */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
