/* ============================================================
   Onihub — estilos dos componentes (classes .oh-*)
   Os componentes React em components/ compõem estas classes.
   ============================================================ */

/* ---------- Botões ---------- */
.oh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-md);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  -webkit-user-select: none;
  user-select: none;
}
.oh-btn:active { transform: scale(0.98); }
.oh-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.oh-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.oh-btn--primary { background: var(--accent); color: var(--text-on-accent); }
.oh-btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.oh-btn--primary:active:not(:disabled) { background: var(--accent-press); }

.oh-btn--secondary {
  background: var(--surface-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.oh-btn--secondary:hover:not(:disabled) { background: var(--surface-sunken); }

.oh-btn--ghost { background: transparent; color: var(--text-secondary); }
.oh-btn--ghost:hover:not(:disabled) { background: var(--surface-sunken); color: var(--text-primary); }

.oh-btn--danger { background: var(--danger); color: #fff; }
.oh-btn--danger:hover:not(:disabled) { filter: brightness(0.93); }

.oh-btn--soft { background: var(--accent-soft); color: var(--accent-text); }
.oh-btn--soft:hover:not(:disabled) { filter: brightness(0.97); }

.oh-btn--sm { height: var(--control-sm); padding: 0 var(--space-4); font-size: var(--text-sm); }
.oh-btn--lg { height: var(--control-lg); padding: 0 var(--space-6); font-size: var(--text-lg); }

/* Botão de ícone */
.oh-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-md);
  height: var(--control-md);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.oh-iconbtn:hover { background: var(--surface-sunken); color: var(--text-primary); }
.oh-iconbtn:active { transform: scale(0.96); }
.oh-iconbtn--outline { border-color: var(--border-strong); background: var(--surface-card); }
.oh-iconbtn--sm { width: var(--control-sm); height: var(--control-sm); }
.oh-iconbtn svg { width: 18px; height: 18px; }
.oh-iconbtn--sm svg { width: 16px; height: 16px; }

/* ---------- Badge / Tag ---------- */
.oh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.oh-badge .oh-badge-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.oh-badge--neutral { background: var(--surface-sunken); color: var(--text-secondary); }
.oh-badge--accent  { background: var(--accent-soft);  color: var(--accent-text); }
.oh-badge--ok      { background: var(--ok-soft);      color: var(--ok); }
.oh-badge--warn    { background: var(--warn-soft);    color: var(--warn); }
.oh-badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.oh-badge--info    { background: var(--info-soft);    color: var(--info); }
.oh-badge--outline { background: transparent; color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ---------- Avatar ---------- */
.oh-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: var(--weight-semibold);
  overflow: hidden;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}
.oh-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Card ---------- */
.oh-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.oh-card--raised { box-shadow: var(--shadow-2); }
.oh-card--flat { box-shadow: none; }
.oh-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.oh-card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
}
.oh-card-body { padding: var(--space-5); }

/* ---------- Formulários ---------- */
.oh-field { display: flex; flex-direction: column; gap: 6px; }
.oh-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.oh-hint { font-size: var(--text-xs); color: var(--text-muted); }
.oh-error-text { font-size: var(--text-xs); color: var(--danger); font-weight: var(--weight-medium); }

.oh-input, .oh-select {
  height: var(--control-md);
  padding: 0 var(--space-4);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-md);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.oh-input::placeholder { color: var(--text-muted); }
.oh-input:hover, .oh-select:hover { border-color: var(--neutral-400); }
.oh-input:focus, .oh-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.oh-input--error { border-color: var(--danger); }
.oh-input--error:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
textarea.oh-input { height: auto; min-height: 88px; padding: var(--space-3) var(--space-4); resize: vertical; }

.oh-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235F716E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* Checkbox */
.oh-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-md);
  color: var(--text-primary);
  -webkit-user-select: none;
  user-select: none;
}
.oh-checkbox input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--border-input);
  border-radius: 5px;
  background: var(--surface-card);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.oh-checkbox input:checked { background: var(--accent); border-color: var(--accent); }
.oh-checkbox input:checked::after {
  content: "";
  width: 10px;
  height: 10px;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
[data-theme="dark"] .oh-checkbox input:checked::after { filter: brightness(0.1); }

/* Switch */
.oh-switch {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 21px;
  flex-shrink: 0;
  cursor: pointer;
}
.oh-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.oh-switch-track {
  width: 100%;
  border-radius: var(--radius-full);
  background: var(--neutral-400);
  transition: background var(--dur-base) var(--ease-out);
}
[data-theme="dark"] .oh-switch-track { background: var(--abyss-600); }
.oh-switch-thumb {
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform var(--dur-base) var(--ease-out);
}
.oh-switch input:checked ~ .oh-switch-track { background: var(--accent); }
.oh-switch input:checked ~ .oh-switch-thumb { transform: translateX(15px); }

/* ---------- Tabs ---------- */
.oh-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
}
.oh-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: var(--space-2) var(--space-3) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}
.oh-tab:hover { color: var(--text-primary); }
.oh-tab.is-active,
.oh-tab[aria-selected="true"] {
  color: var(--accent-text);
  font-weight: var(--weight-semibold);
  border-bottom-color: var(--accent);
}

/* Tabs pílula (segmented) */
.oh-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-sunken);
  border-radius: var(--radius-full);
}
.oh-segmented .oh-tab {
  border: none;
  margin: 0;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
}
.oh-segmented .oh-tab.is-active,
.oh-segmented .oh-tab[aria-selected="true"] {
  background: var(--surface-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
}

/* ---------- Tooltip ---------- */
.oh-tooltip-wrap { position: relative; display: inline-flex; }
.oh-tooltip {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  z-index: 50;
}
.oh-tooltip-wrap:hover .oh-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Toast ---------- */
.oh-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 340px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
.oh-toast-icon { display: grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.oh-toast-icon svg { width: 18px; height: 18px; }
.oh-toast--ok .oh-toast-icon { color: var(--ok); }
.oh-toast--danger .oh-toast-icon { color: var(--danger); }
.oh-toast--warn .oh-toast-icon { color: var(--warn); }
.oh-toast--info .oh-toast-icon { color: var(--info); }
.oh-toast-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.oh-toast-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* ---------- Modal ---------- */
.oh-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: grid;
  place-items: center;
  padding: var(--space-6);
  z-index: 100;
}
.oh-modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.oh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6) 0;
}
.oh-modal-title { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-title); }
.oh-modal-body { padding: var(--space-4) var(--space-6); color: var(--text-secondary); }
.oh-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6) var(--space-5);
}

/* ---------- Empty state ---------- */
.oh-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
}
.oh-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-2);
}
.oh-empty-icon svg { width: 20px; height: 20px; }
.oh-empty-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-title); }
.oh-empty-desc { font-size: var(--text-sm); color: var(--text-secondary); max-width: 360px; }

/* ---------- Sidebar ---------- */
.oh-sidebar {
  display: flex;
  flex-direction: column;
  width: 232px;
  height: 100%;
  background: var(--surface-sunken);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-3);
  gap: 2px;
}
[data-theme="dark"] .oh-sidebar { background: var(--surface-page); }
.oh-sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}
.oh-sidebar-section {
  padding: var(--space-4) var(--space-3) var(--space-1);
}
.oh-sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
  text-align: left;
  width: 100%;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.oh-sidebar-item:hover { background: var(--surface-card); color: var(--text-primary); box-shadow: var(--shadow-1); }
.oh-sidebar-item.is-active,
.oh-sidebar-item[aria-current="true"] {
  background: var(--surface-card);
  color: var(--accent-text);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-1);
}
[data-theme="dark"] .oh-sidebar-item:hover,
[data-theme="dark"] .oh-sidebar-item.is-active,
[data-theme="dark"] .oh-sidebar-item[aria-current="true"] { background: var(--surface-card); }
.oh-sidebar-item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ---------- Topbar ---------- */
.oh-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 60px;
  padding: 0 var(--space-6);
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-subtle);
}
.oh-topbar-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-title);
}

/* ---------- Tabela ---------- */
.oh-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.oh-table th {
  text-align: left;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.oh-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.oh-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.oh-table tbody tr:hover { background: var(--surface-sunken); }
.oh-table .num { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ---------- Spinner ---------- */
@keyframes oh-spin { to { transform: rotate(360deg); } }
.oh-spinner { animation: oh-spin 0.8s linear infinite; }
