/* Global App Theme Overrides for Bootstrap 5 */

/* Typography and base variables */
:root {
  --app-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Heiti SC",
    "Noto Sans CJK SC", Arial, sans-serif;
  --app-card-radius: 0.75rem;
  --app-card-shadow: 0 10px 20px rgba(0, 0, 0, 0.06),
    0 2px 6px rgba(0, 0, 0, 0.04);
  --app-focus-ring: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  --app-muted: #6b7280;
}

html, body {
  font-family: var(--app-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.main-container {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Navbar */
.navbar {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.navbar .navbar-brand {
  letter-spacing: 0.2px;
}
.navbar .nav-link {
  transition: color 0.2s ease, opacity 0.2s ease;
}
.navbar .nav-link:hover {
  opacity: 0.9;
}

/* Cards */
.card {
  border-radius: var(--app-card-radius);
  box-shadow: var(--app-card-shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.card-header {
  border-top-left-radius: var(--app-card-radius) !important;
  border-top-right-radius: var(--app-card-radius) !important;
}

/* Buttons */
.btn {
  transition: transform 0.06s ease, box-shadow 0.2s ease, background-color 0.2s ease,
    color 0.2s ease, border-color 0.2s ease;
}
.btn:active {
  transform: translateY(1px);
}

/* Forms */
.form-control,
.form-select {
  border-radius: 0.5rem;
}
.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: var(--app-focus-ring);
}
.form-text {
  color: var(--app-muted);
}

/* Tabs */
.nav-tabs {
  border-bottom: 0;
  gap: 0.25rem;
}
.nav-tabs .nav-link {
  border: 0;
  color: var(--app-muted);
  border-radius: 0.5rem;
}
.nav-tabs .nav-link.active {
  color: #1d4ed8;
  background-color: #eef2ff;
}

/* Tables */
table.table thead th,
.table thead th {
  background-color: #f8fafc;
}

/* Alerts */
.alert {
  border-radius: 0.75rem;
}
.alert-info {
  border-left: 4px solid #0ea5e9;
}
.alert-warning {
  border-left: 4px solid #f59e0b;
}
.alert-danger {
  border-left: 4px solid #ef4444;
}

/* Badge */
.badge {
  border-radius: 0.35rem;
}

/* Helper spacing for section titles */
.section-title {
  margin-bottom: 0.75rem;
}
.section-subtitle {
  color: var(--app-muted);
}

/* PDF mobile controls enhancements */
.pdf-controls .btn {
  border-radius: 0.4rem !important;
}
.pdf-canvas {
  border-radius: 0.5rem;
}

/* Dark mode */
/* Apply by setting data-theme="dark" on <html> or <body> */
[data-theme="dark"] {
  --app-muted: #9aa4b2;
}
[data-theme="dark"] body,
body[data-theme="dark"] {
  background-color: #0b1120 !important;
  color: #e5e7eb !important;
}
[data-theme="dark"] .navbar {
  background-color: #0f172a !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .card {
  background-color: #0f172a;
  border-color: #1f2937;
  box-shadow: none;
}
[data-theme="dark"] .card-header {
  background-color: #111827;
  color: #e5e7eb;
}
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
  color: #e5e7eb;
  border-color: #243244 !important;
}
[data-theme="dark"] .table thead th {
  background-color: #111827;
}
[data-theme="dark"] .alert-info {
  background-color: #022c43;
  color: #cfe8ff;
}
[data-theme="dark"] .alert-warning {
  background-color: #3a2e0b;
  color: #fde68a;
}
[data-theme="dark"] .alert-danger {
  background-color: #3f0b0b;
  color: #fecaca;
}
[data-theme="dark"] .nav-tabs .nav-link {
  color: #a1a1aa;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  color: #93c5fd;
  background-color: #0b1220;
  box-shadow: inset 0 0 0 1px #1f2937;
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #111827;
  color: #e5e7eb;
  border-color: #1f2937;
}
[data-theme="dark"] .form-control::placeholder {
  color: #9aa4b2;
}
[data-theme="dark"] .btn-outline-primary {
  color: #93c5fd;
  border-color: #1f3a65;
}
[data-theme="dark"] .btn-outline-primary:hover {
  background-color: #1f3a65;
}

/* Utilities */
.shadow-soft {
  box-shadow: var(--app-card-shadow);
}
.rounded-xl {
  border-radius: 1rem !important;
}
.text-muted-2 {
  color: var(--app-muted) !important;
}


