/**
 * OMNI Bot – custom.css
 * Nền sáng · form rõ · border + shadow · tiêu đề phân tầng
 */

:root {
  --omni-bg: #f0f4f8;
  --omni-surface: #ffffff;
  --omni-surface-2: #f8fafc;
  --omni-border: #a3b6cf;
  --omni-border-focus: #3b82f6;
  --omni-text: #1e293b;
  --omni-text-muted: #64748b;
  --omni-primary: #2563eb;
  --omni-primary-hover: #1d4ed8;
  --omni-primary-soft: #eff6ff;
  --omni-success: #16a34a;
  --omni-success-soft: #f0fdf4;
  --omni-warning: #d97706;
  --omni-warning-soft: #fffbeb;
  --omni-danger: #dc2626;
  --omni-danger-soft: #fef2f2;
  --omni-info: #0891b2;
  --omni-info-soft: #ecfeff;
  --omni-sidebar: #0f172a;
  --omni-sidebar-hover: #1e293b;
  --omni-radius: 12px;
  --omni-radius-sm: 8px;
  --omni-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --omni-shadow-lg: 0 8px 28px rgba(15, 23, 42, 0.1);
  --omni-shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.2);
  --omni-font: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
}

/* ========== Base ========== */
html {
  font-size: 15px;
}

body {
  background: var(--omni-bg) !important;
  color: var(--omni-text);
  font-family: var(--omni-font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.content {
  padding: 28px 32px !important;
  max-width: 1280px;
}

h1, h2, h3, h4, h5, .h1, .h2, .h3 {
  color: var(--omni-text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3.mb-0,
.content > .d-flex h3 {
  font-size: 1.55rem;
  color: #0f172a;
}

.text-muted,
.form-text {
  color: var(--omni-text-muted) !important;
}

a {
  color: var(--omni-primary);
}

a:hover {
  color: var(--omni-primary-hover);
}

/* ========== Sidebar ========== */
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
  min-height: 100vh;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
}

.sidebar .p-3.text-white.fw-bold {
  font-size: 1.15rem !important;
  padding: 1.25rem 1.25rem 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.02em;
}

.sidebar a {
  color: #94a3b8 !important;
  text-decoration: none;
  display: block;
  padding: 12px 20px !important;
  margin: 2px 10px;
  border-radius: var(--omni-radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar a:hover {
  color: #fff !important;
  background: var(--omni-sidebar-hover) !important;
}

.sidebar a.active {
  color: #fff !important;
  background: var(--omni-primary) !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar a i {
  margin-right: 8px;
  opacity: 0.9;
}

/* ========== Cards / Sections ========== */
.card {
  background: var(--omni-surface) !important;
  border: 1px solid var(--omni-border) !important;
  border-radius: var(--omni-radius) !important;
  box-shadow: var(--omni-shadow) !important;
  margin-bottom: 1.35rem;
  overflow: hidden;
}

.card-header {
  background: var(--omni-surface-2) !important;
  border-bottom: 1px solid var(--omni-border) !important;
  padding: 0.9rem 1.25rem !important;
  font-weight: 700 !important;
  font-size: 0.98rem;
  color: #0f172a !important;
  letter-spacing: -0.01em;
}

.card-header.bg-primary,
.card-header.bg-primary.text-white {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border-bottom: none !important;
  color: #fff !important;
}

.card-header.fw-bold {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.35rem 1.35rem 1.5rem !important;
  background: var(--omni-surface);
}

.card.border-primary {
  border-color: #93c5fd !important;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.1) !important;
}

.card.mb-4 {
  margin-bottom: 1.5rem !important;
}

/* Section accent bar on left of card header */
.card > .card-header:not(.bg-primary)::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--omni-primary);
  border-radius: 2px;
  margin-right: 0.55rem;
  vertical-align: -0.1em;
}

/* ========== Labels ========== */
.form-label {
  font-weight: 600 !important;
  color: #334155 !important;
  font-size: 0.88rem;
  margin-bottom: 0.4rem !important;
  letter-spacing: 0.01em;
}

.form-label .text-danger,
.form-label:has(+ .form-control[required]) {
  /* keep * visible */
}

/* ========== Inputs / Textarea / Select ========== */
.form-control,
.form-select {
  background-color: #fff !important;
  border: 1.5px solid var(--omni-border) !important;
  border-radius: var(--omni-radius-sm) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  color: var(--omni-text) !important;
  padding: 0.6rem 0.85rem !important;
  font-size: 0.95rem !important;
  min-height: 42px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:hover,
.form-select:hover {
  border-color: #cbd5e1 !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--omni-border-focus) !important;
  box-shadow: var(--omni-shadow-focus) !important;
  outline: none !important;
  background-color: #fff !important;
}

.form-control::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

textarea.form-control {
  min-height: 110px;
  line-height: 1.5;
  resize: vertical;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.85rem center !important;
  background-size: 14px 10px !important;
  padding-right: 2.4rem !important;
  cursor: pointer;
}

.form-select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

.form-control-sm,
.form-select-sm {
  min-height: 34px;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.85rem !important;
}

input[type="file"].form-control {
  padding: 0.45rem 0.75rem !important;
}

input[type="password"].form-control,
input[type="text"].form-control,
input[type="email"].form-control,
input[type="number"].form-control {
  letter-spacing: 0.01em;
}

/* ========== Checkbox / Radio ========== */
.form-check {
  padding: 0.45rem 0.5rem 0.45rem 1.85rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.form-check:hover {
  background: var(--omni-primary-soft);
}

.form-check-input {
  width: 1.15em !important;
  height: 1.15em !important;
  margin-top: 0.2em !important;
  border: 1.5px solid #94a3b8 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--omni-primary) !important;
  border-color: var(--omni-primary) !important;
}

.form-check-input:focus {
  box-shadow: var(--omni-shadow-focus) !important;
  border-color: var(--omni-primary) !important;
}

.form-check-label {
  color: #334155;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.92rem;
}

/* ========== Buttons ========== */
.btn {
  border-radius: var(--omni-radius-sm) !important;
  font-weight: 600 !important;
  padding: 0.55rem 1.15rem !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border: 1px solid #1d4ed8 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8) !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4) !important;
}

.btn-outline-primary {
  border: 1.5px solid #93c5fd !important;
  color: var(--omni-primary) !important;
  background: #fff !important;
}

.btn-outline-primary:hover {
  background: var(--omni-primary-soft) !important;
  border-color: var(--omni-primary) !important;
}

.btn-outline-danger {
  border: 1.5px solid #fca5a5 !important;
  color: var(--omni-danger) !important;
  background: #fff !important;
}

.btn-outline-danger:hover {
  background: var(--omni-danger-soft) !important;
}

.btn-outline-warning {
  border: 1.5px solid #fcd34d !important;
  color: #b45309 !important;
  background: #fff !important;
}

.btn-outline-warning:hover {
  background: var(--omni-warning-soft) !important;
}

.btn-outline-info {
  border: 1.5px solid #67e8f9 !important;
  color: #0e7490 !important;
  background: #fff !important;
}

.btn-outline-info:hover {
  background: var(--omni-info-soft) !important;
}

.btn-outline-secondary {
  border: 1.5px solid var(--omni-border) !important;
  color: #475569 !important;
  background: #fff !important;
}

.btn-outline-secondary:hover {
  background: var(--omni-surface-2) !important;
}

.btn-sm {
  padding: 0.35rem 0.7rem !important;
  font-size: 0.8rem !important;
}

.btn-group-sm > .btn {
  padding: 0.35rem 0.65rem !important;
  font-size: 0.78rem !important;
}

/* ========== Tables ========== */
.table {
  --bs-table-bg: transparent;
  color: var(--omni-text);
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background: var(--omni-surface-2) !important;
  color: #475569 !important;
  font-weight: 700 !important;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--omni-border) !important;
  padding: 0.85rem 1rem !important;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.85rem 1rem !important;
  vertical-align: middle !important;
  border-bottom: 1px solid var(--omni-border) !important;
  font-size: 0.92rem;
}

.table-hover tbody tr:hover {
  background: var(--omni-primary-soft) !important;
}

.table tbody tr:last-child td {
  border-bottom: none !important;
}

.card .table-responsive {
  border-radius: 0 0 var(--omni-radius) var(--omni-radius);
}

/* ========== Badges ========== */
.badge {
  font-weight: 600 !important;
  padding: 0.4em 0.7em !important;
  border-radius: 6px !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.02em;
}

.badge.bg-success {
  background: var(--omni-success-soft) !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0;
}

.badge.bg-danger {
  background: var(--omni-danger-soft) !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca;
}

.badge.bg-warning,
.badge.bg-warning.text-dark {
  background: var(--omni-warning-soft) !important;
  color: #b45309 !important;
  border: 1px solid #fde68a;
}

.badge.bg-primary {
  background: var(--omni-primary-soft) !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe;
}

.badge.bg-secondary {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0;
}

/* ========== Alerts / tips ========== */
.alert {
  border-radius: var(--omni-radius-sm) !important;
  border: 1px solid transparent !important;
  box-shadow: var(--omni-shadow);
}

.alert-info {
  background: var(--omni-info-soft) !important;
  border-color: #a5f3fc !important;
  color: #155e75 !important;
}

.alert-warning {
  background: var(--omni-warning-soft) !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

.alert-success {
  background: var(--omni-success-soft) !important;
  border-color: #bbf7d0 !important;
  color: #166534 !important;
}

/* ========== Form layout helpers ========== */
.row.g-3 > [class*="col-"] {
  margin-bottom: 0.15rem;
}

.form-text {
  font-size: 0.8rem !important;
  margin-top: 0.35rem !important;
  line-height: 1.4;
}

/* Group of plugin checkboxes in a soft box */
.card-body .form-check.plugin,
.card-body .form-check:has(.plugin) {
  border: 1px solid var(--omni-border);
  background: var(--omni-surface-2);
  margin-right: 0.35rem;
  margin-bottom: 0.4rem;
  display: inline-block;
  min-width: 160px;
}

/* Nested card sections (AI block etc.) */
.card .card {
  box-shadow: none !important;
  border-color: #e2e8f0 !important;
}

/* Page title row */
.d-flex.justify-content-between.align-items-center.mb-4 {
  margin-bottom: 1.75rem !important;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--omni-border);
}

/* ========== Input groups ========== */
.input-group .form-control,
.input-group .form-select {
  box-shadow: none !important;
}

.input-group {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  border-radius: var(--omni-radius-sm);
}

.input-group-text {
  background: var(--omni-surface-2) !important;
  border: 1.5px solid var(--omni-border) !important;
  color: var(--omni-text-muted) !important;
  font-weight: 500;
}

/* ========== Misc ========== */
hr {
  border-color: var(--omni-border);
  opacity: 1;
}

code, .form-control[readonly] {
  background: #f1f5f9 !important;
}

/* Strong domain text in tables */
td strong {
  color: #0f172a;
  font-weight: 700;
}

/* Scrollbar (webkit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #e2e8f0;
}
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
  .content {
    padding: 16px !important;
  }
  .sidebar {
    min-height: auto !important;
  }
  .card-body {
    padding: 1rem !important;
  }
}
