/* FormHub — Dsignxt brand theme (https://www.dsignxt.com/) */
:root {
  --fc-navy: #02021e;
  --fc-navy-soft: #02031c;
  --fc-purple: #3827c7;
  --fc-purple-dark: #3330bf;
  --fc-purple-light: #5240e0;
  --fc-gold: #fdc448;
  --fc-orange: #ff8300;
  --fc-sidebar: #02021e;
  --fc-sidebar-hover: rgba(56, 39, 199, 0.18);
  --fc-accent: #3827c7;
  --fc-accent-dark: #3330bf;
  --fc-accent-light: rgba(56, 39, 199, 0.1);
  --fc-bg: #f4f3fb;
  --fc-card: #ffffff;
  --fc-text: #02021e;
  --fc-muted: #6b7280;
  --fc-border: #e8e6f5;
  --fc-sidebar-width: 260px;
  --fc-radius: 0.85rem;
  --fc-shadow: 0 4px 24px rgba(2, 2, 30, 0.06);
  --fc-shadow-lg: 0 12px 40px rgba(2, 2, 30, 0.12);
}

[data-theme="dark"] {
  --fc-sidebar: #02021e;
  --fc-sidebar-hover: rgba(56, 39, 199, 0.25);
  --fc-bg: #0a0a1a;
  --fc-card: #12122a;
  --fc-text: #f0f0f8;
  --fc-muted: #9ca3af;
  --fc-border: #1e1e3a;
  --fc-accent-light: rgba(56, 39, 199, 0.2);
  --fc-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --fc-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--fc-bg);
  color: var(--fc-text);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--fc-purple); }
a:hover { color: var(--fc-purple-dark); }

.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--fc-sidebar-width);
  background: linear-gradient(180deg, var(--fc-navy) 0%, var(--fc-navy-soft) 100%);
  color: rgba(255, 255, 255, 0.85);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  overflow-y: auto;
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(56, 39, 199, 0.25);
}

.sidebar-brand {
  padding: 1.35rem 1.25rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  width: auto;
  height: auto;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
}

.sidebar-logo-img {max-height: 100px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.25rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-brand small {
  color: rgba(255, 255, 255, 0.5);
  font-size: .72rem;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  padding: .75rem 0 1rem;
  flex: 1;
}

.nav-section {
  padding: .85rem 1.25rem .35rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255, 255, 255, 0.72);
  padding: .62rem 1.25rem;
  border-left: 3px solid transparent;
  font-size: .9rem;
  font-weight: 500;
  transition: all .18s ease;
  margin: 1px 0;
}

.sidebar .nav-link i { font-size: 1.05rem; opacity: 0.85; }

.sidebar .nav-link:hover {
  background: var(--fc-sidebar-hover);
  color: #fff;
}

.sidebar .nav-link.active {
  background: var(--fc-sidebar-hover);
  color: #fff;
  border-left-color: var(--fc-gold);
}

.sidebar .nav-link.active i { color: var(--fc-gold); }

.sidebar .nav-link .badge {
  font-size: .65rem;
  padding: .2em .45em;
  margin-left: auto;
  background: var(--fc-purple) !important;
}

.nav-group { margin-bottom: .15rem; }

.nav-group-toggle {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  display: flex;
  align-items: center;
  gap: .65rem;
}

.nav-group-toggle:hover,
.nav-group.is-open > .nav-group-toggle {
  background: var(--fc-sidebar-hover);
  color: #fff;
}

.nav-group-chevron {
  font-size: .75rem;
  opacity: .75;
  transition: transform .2s ease;
}

.nav-group.is-open .nav-group-chevron,
.nav-group-toggle[aria-expanded="true"] .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-submenu .nav-sublink {
  padding-left: 2.35rem;
  font-size: .92rem;
}

.nav-submenu .nav-sublink i {
  font-size: .45rem;
  opacity: .65;
}


.sidebar-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  color: rgba(255, 255, 255, 0.45);
  transition: color .18s;
}

.sidebar-footer a:hover { color: var(--fc-gold); }
.sidebar-footer i { color: var(--fc-gold); font-size: .85rem; }

/* ── Main layout ── */
.main-content {
  margin-left: var(--fc-sidebar-width);
  flex: 1;
  min-width: 0;
}

.topbar {
  background: var(--fc-card);
  border-bottom: 1px solid var(--fc-border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--fc-shadow);
}

.topbar .form-control {
  border-color: var(--fc-border);
  background: var(--fc-bg);
  border-radius: 2rem;
  font-size: .88rem;
}

.topbar .form-control:focus {
  border-color: var(--fc-purple);
  box-shadow: 0 0 0 3px rgba(56, 39, 199, 0.15);
}

.topbar .input-group-text {
  border-color: var(--fc-border);
  background: var(--fc-bg);
  border-radius: 2rem 0 0 2rem;
  color: var(--fc-muted);
}

.topbar .btn-light {
  background: var(--fc-bg);
  border: 1px solid var(--fc-border);
  border-radius: 2rem;
  font-weight: 500;
  font-size: .88rem;
}

.topbar .btn-outline-secondary,
.topbar .btn-outline-primary {
  border-radius: 0.5rem;
}

.content-area { padding: 1.5rem; }

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  letter-spacing: -0.02em;
  color: var(--fc-text);
}

.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
  font-size: .85rem;
}

.breadcrumb-item a { color: var(--fc-purple); }
.breadcrumb-item.active { color: var(--fc-muted); }

/* ── Cards & stats ── */
.stat-card {
  background: var(--fc-card);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  padding: 1.15rem 1.25rem;
  height: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: var(--fc-shadow);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--fc-shadow-lg);
}

.stat-card .label {
  color: var(--fc-muted);
  font-size: .8rem;
  margin-bottom: .35rem;
  font-weight: 500;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--fc-accent-light);
  color: var(--fc-purple);
  font-size: 1.15rem;
}

.card-panel {
  background: var(--fc-card);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--fc-shadow);
  overflow: hidden;
}

.card-panel .card-header {
  background: transparent;
  border-bottom: 1px solid var(--fc-border);
  padding: .95rem 1.2rem;
  font-weight: 600;
  font-size: .95rem;
}

.card-panel .card-body { padding: 1.2rem; }

.filter-bar {
  background: var(--fc-card);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--fc-shadow);
}

/* ── Buttons ── */
.btn-accent {
  background: linear-gradient(135deg, var(--fc-purple) 0%, var(--fc-purple-dark) 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 0.55rem;
  padding: .5rem 1.1rem;
  transition: all .18s ease;
  box-shadow: 0 4px 14px rgba(56, 39, 199, 0.3);
}

.btn-accent:hover,
.btn-accent:focus {
  background: linear-gradient(135deg, var(--fc-purple-light) 0%, var(--fc-purple) 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 39, 199, 0.4);
}

.btn-primary {
  background: var(--fc-purple);
  border-color: var(--fc-purple);
}

.btn-primary:hover {
  background: var(--fc-purple-dark);
  border-color: var(--fc-purple-dark);
}

.btn-outline-primary {
  color: var(--fc-purple);
  border-color: var(--fc-purple);
}

.btn-outline-primary:hover {
  background: var(--fc-purple);
  border-color: var(--fc-purple);
}

/* ── Forms ── */
.form-control,
.form-select {
  border-color: var(--fc-border);
  border-radius: 0.55rem;
  font-size: .92rem;
  padding: .5rem .85rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--fc-purple);
  box-shadow: 0 0 0 3px rgba(56, 39, 199, 0.12);
}

.form-label {
  font-weight: 500;
  font-size: .88rem;
  color: var(--fc-text);
}

.form-check-input:checked {
  background-color: var(--fc-purple);
  border-color: var(--fc-purple);
}

/* ── Tables ── */
.table thead th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fc-muted);
  border-bottom-width: 1px;
  white-space: nowrap;
  font-weight: 600;
  background: var(--fc-bg);
}

.table td { vertical-align: middle; font-size: .9rem; }

.table-hover tbody tr:hover { background: var(--fc-accent-light); }

.badge.bg-primary,
.badge.bg-success { font-weight: 500; }

/* ── Alerts & toasts ── */
.alert-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.fc-toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(480px, calc(100% - 2rem));
  pointer-events: none;
}

.fc-toast {
  pointer-events: auto;
  width: 100%;
  margin: 0;
  border-radius: var(--fc-radius);
  box-shadow: var(--fc-shadow-lg);
  transform: translateY(calc(100% + 2rem));
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.fc-toast.show { transform: translateY(0); opacity: 1; }
.fc-toast.hiding { transform: translateY(calc(100% + 2rem)); opacity: 0; }

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fc-navy);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--fc-radius);
  padding: 2rem;
  box-shadow: var(--fc-shadow-lg);
}

.auth-brand-logo {
  text-align: center;
  margin-bottom: 1rem;
}

.auth-brand-logo img {
  height: 48px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.auth-card h2 {text-align: center;
  font-weight: 700;
  margin-bottom: .25rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--fc-navy);
}

.auth-card .subtitle {text-align: center;
  color: var(--fc-muted);
  margin-bottom: 1.5rem;
  font-size: .92rem;
}

.auth-card .form-control {
  padding: .6rem .9rem;
}

.auth-link {
  color: var(--fc-purple);
  font-weight: 500;
  font-size: .88rem;
}

.auth-link:hover { color: var(--fc-purple-dark); }

.password-toggle-wrap {
  position: relative;
}

.password-toggle-wrap .form-control {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  line-height: 0;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
  opacity: 1;
  outline: none;
}

.password-toggle-btn img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ── Dark mode overrides ── */
[data-theme="dark"] .topbar,
[data-theme="dark"] .auth-card { background: var(--fc-card); }

[data-theme="dark"] .auth-card h2 { color: var(--fc-text); }

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--fc-bg);
  color: var(--fc-text);
  border-color: var(--fc-border);
}

[data-theme="dark"] .table thead th { background: var(--fc-bg); }

[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

[data-theme="dark"] .alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

#sidebarToggle { display: none; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 30, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loading-overlay.show { display: flex; }

.loading-overlay .spinner-border { color: var(--fc-gold) !important; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  #sidebarToggle { display: inline-flex; }
}

@media (max-width: 575.98px) {
  .content-area { padding: 1rem; }
  .topbar { padding: .65rem 1rem; }
}

.status-drag-handle {
  cursor: grab;
  font-size: 1.1rem;
  opacity: .55;
}

.status-drag-handle:active {
  cursor: grabbing;
}

.status-row-ghost {
  opacity: .45;
  background: rgba(124, 58, 237, 0.08) !important;
}

.status-row:hover .status-drag-handle {
  opacity: 1;
}
