/* Global UI components — theme-aware tables, forms, typography */

/* Typography */
.app-content h1:not(.hc-hero-title),
.app-content h2,
.app-content h3,
.app-content h4,
.auth-content h1,
.auth-content h2,
.auth-content h3,
.auth-content h4 {
  color: var(--text-heading);
}

.page-subtitle,
.text-muted {
  color: var(--muted);
}

/* Layout helpers */
.page-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.page-card,
.page-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  box-sizing: border-box;
  color: var(--text);
}

.page-section {
  margin-bottom: 16px;
}

/* Tables — global cascade for bare tables */
.app-content table,
.auth-content table,
.hc-ops table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
}

.app-content table th,
.app-content table td,
.auth-content table th,
.auth-content table td,
.hc-ops table th,
.hc-ops table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.app-content table th,
.auth-content table th,
.hc-ops table th,
.hc-table th {
  background: var(--surface-muted);
  color: var(--text-heading);
  font-weight: 800;
}

.app-content table td,
.auth-content table td,
.hc-ops table td,
.hc-table td {
  background: var(--surface);
  color: var(--text);
}

.app-content table tbody tr:hover td,
.hc-table tbody tr:hover td {
  background: var(--surface-muted);
}

.app-content table thead th,
.hc-table thead th {
  position: relative;
}

/* Forms */
.app-content input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.app-content select,
.app-content textarea,
.auth-content input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.auth-content select,
.auth-content textarea,
.hc-ops input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.hc-ops select,
.hc-ops textarea {
  font: inherit;
  color: var(--text);
  background-color: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-sizing: border-box;
}

.app-content input:focus,
.app-content select:focus,
.app-content textarea:focus,
.auth-content input:focus,
.auth-content select:focus,
.auth-content textarea:focus,
.hc-ops input:focus,
.hc-ops select:focus,
.hc-ops textarea:focus {
  outline: none;
  border-color: rgba(53, 205, 53, 0.45);
  box-shadow: 0 0 0 4px rgba(53, 205, 53, 0.15);
}

.app-content label,
.auth-content label,
.hc-ops label {
  color: var(--text-heading);
}

/* Alerts (shared with auth.css patterns) */
.alert {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.45;
}

.alert-warning {
  background: var(--msg-warning-bg);
  border-color: var(--msg-warning-border);
  color: var(--msg-warning-text);
}

.alert-error,
.alert-danger {
  background: var(--msg-error-bg);
  border-color: var(--msg-error-border);
  color: var(--msg-error-text);
}

.alert-success {
  background: var(--msg-success-bg);
  border-color: var(--msg-success-border);
  color: var(--msg-success-text);
}

.alert-info {
  background: var(--msg-info-bg);
  border-color: var(--msg-info-border);
  color: var(--msg-info-text);
}

/* Badges / chips */
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

/* Theme toggle */
.theme-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-heading);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.04);
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.auth-theme-toggle-wrap {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

/* Print — always light */
@media print {
  html {
    color-scheme: light;
  }

  html[data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --surface-muted: #f5f7fb;
    --border: #e7e7e7;
    --text: #111111;
    --text-heading: #0f172a;
    --muted: rgba(17, 17, 17, 0.75);
  }
}
