/* ==========================================================================
   VOT CRM — Brand Stylesheet
   Palette inspired by votafrica.co.tz: deep professional blue, gold accent,
   soft shadows, generous rounding — aiming at a premium SaaS CRM feel
   (Salesforce / HubSpot / Zoho-adjacent) rather than a stock Bootstrap admin.
   ========================================================================== */

:root {
  /* Brand colors */
  --vot-blue: #0b3d91;
  --vot-blue-dark: #082a66;
  --vot-blue-darker: #051c47;
  --vot-blue-light: #e8effb;
  --vot-gold: #d4af37;
  --vot-gold-dark: #b8942a;
  --vot-gold-light: #f4e4b0;

  /* Neutrals */
  --vot-bg: #f4f6fb;
  --vot-surface: #ffffff;
  --vot-border: #e6e9f2;
  --vot-text: #1c2536;
  --vot-text-muted: #6b7488;

  /* Semantic */
  --vot-success: #1e9e6a;
  --vot-danger: #d9455f;
  --vot-warning: #e8a53d;
  --vot-info: #2f7dd1;

  /* Effects */
  --vot-radius: 0.85rem;
  --vot-radius-sm: 0.55rem;
  --vot-shadow-sm: 0 2px 8px rgba(11, 61, 145, 0.06);
  --vot-shadow: 0 8px 24px rgba(11, 61, 145, 0.09);
  --vot-shadow-lg: 0 16px 40px rgba(11, 61, 145, 0.14);
  --vot-sidebar-width: 264px;
  --vot-sidebar-collapsed: 84px;
  --vot-navbar-height: 68px;

  --bs-body-font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-bs-theme="dark"] {
  --vot-bg: #0e1526;
  --vot-surface: #151d33;
  --vot-border: #263354;
  --vot-text: #e8ecf7;
  --vot-text-muted: #9aa4c2;
  --vot-blue-light: #1b2745;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  background: var(--vot-bg);
  color: var(--vot-text);
  font-family: var(--bs-body-font-family);
  font-size: 0.94rem;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--vot-blue); text-decoration: none; }
a:hover { color: var(--vot-gold-dark); }

/* ---------------------------------------------------------------------- */
/* Auth pages                                                             */
/* ---------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--vot-bg);
}

.auth-brand-panel {
  background: linear-gradient(155deg, var(--vot-blue-darker) 0%, var(--vot-blue) 55%, #124fb8 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::after {
  content: "";
  position: absolute;
  inset: auto -20% -30% auto;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(212,175,55,0.35) 0%, rgba(212,175,55,0) 70%);
  border-radius: 50%;
}

.auth-brand-panel .brand-logo {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.35rem;
}

.auth-brand-panel .brand-logo .badge-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--vot-gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--vot-blue-darker);
  font-weight: 900;
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

@media (max-width: 991.98px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
}

/* ---------------------------------------------------------------------- */
/* App shell: sidebar + navbar                                            */
/* ---------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--vot-sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--vot-blue-darker) 0%, var(--vot-blue-dark) 100%);
  color: #dbe4fb;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: width .2s ease, transform .2s ease;
}

.sidebar.collapsed { width: var(--vot-sidebar-collapsed); }

.sidebar-brand {
  height: var(--vot-navbar-height);
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.25rem;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand .badge-mark {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--vot-gold);
  color: var(--vot-blue-darker);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .75rem;
}

.sidebar-nav .nav-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #7f8db5;
  padding: .75rem .75rem .35rem;
}

.sidebar-nav .nav-link {
  color: #c4d0f0;
  border-radius: var(--vot-radius-sm);
  padding: .62rem .8rem;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--vot-gold);
  color: var(--vot-blue-darker);
  font-weight: 700;
  box-shadow: var(--vot-shadow-sm);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-brand .brand-text,
.sidebar.collapsed .nav-section-title {
  display: none;
}

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

.main-wrapper {
  margin-left: var(--vot-sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

.main-wrapper.expanded { margin-left: var(--vot-sidebar-collapsed); }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper, .main-wrapper.expanded { margin-left: 0; }
}

.topbar {
  height: var(--vot-navbar-height);
  background: var(--vot-surface);
  border-bottom: 1px solid var(--vot-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar .global-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.topbar .global-search input {
  border-radius: 999px;
  padding-left: 2.5rem;
  background: var(--vot-bg);
  border: 1px solid var(--vot-border);
}

.topbar .global-search i {
  position: absolute;
  left: .9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--vot-text-muted);
}

.topbar .icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--vot-text-muted);
  background: var(--vot-bg);
  border: 1px solid var(--vot-border);
  position: relative;
}

.topbar .icon-btn:hover { color: var(--vot-blue); }

.topbar .icon-btn .notif-dot {
  position: absolute; top: 6px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--vot-danger);
  border: 2px solid var(--vot-surface);
}

.page-content { padding: 1.75rem; flex: 1; }

/* ---------------------------------------------------------------------- */
/* Cards & KPI tiles                                                      */
/* ---------------------------------------------------------------------- */
.card {
  border: 1px solid var(--vot-border);
  border-radius: var(--vot-radius);
  box-shadow: var(--vot-shadow-sm);
  background: var(--vot-surface);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--vot-border);
  font-weight: 700;
}

.kpi-card {
  border-radius: var(--vot-radius);
  border: 1px solid var(--vot-border);
  background: var(--vot-surface);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--vot-shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--vot-shadow); }

.kpi-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  color: #fff;
}

.kpi-icon.bg-blue { background: linear-gradient(135deg, var(--vot-blue), #1a5cd0); }
.kpi-icon.bg-gold { background: linear-gradient(135deg, var(--vot-gold-dark), var(--vot-gold)); color: var(--vot-blue-darker); }
.kpi-icon.bg-success { background: linear-gradient(135deg, #167a52, var(--vot-success)); }
.kpi-icon.bg-danger { background: linear-gradient(135deg, #a8324a, var(--vot-danger)); }
.kpi-icon.bg-info { background: linear-gradient(135deg, #205fa1, var(--vot-info)); }

.kpi-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.kpi-label { color: var(--vot-text-muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-delta { font-size: .78rem; font-weight: 700; }
.kpi-delta.up { color: var(--vot-success); }
.kpi-delta.down { color: var(--vot-danger); }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn { border-radius: var(--vot-radius-sm); font-weight: 600; padding: .5rem 1.05rem; }
.btn-sm { padding: .3rem .7rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.btn-primary {
  background: var(--vot-blue);
  border-color: var(--vot-blue);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--vot-blue-dark);
  border-color: var(--vot-blue-dark);
}

.btn-gold {
  background: var(--vot-gold);
  border-color: var(--vot-gold);
  color: var(--vot-blue-darker);
}
.btn-gold:hover { background: var(--vot-gold-dark); border-color: var(--vot-gold-dark); color: #fff; }

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

.btn-loading .btn-spinner { display: none; }
.btn-loading.is-loading .btn-spinner { display: inline-block; }
.btn-loading.is-loading .btn-label { opacity: .7; }

/* ---------------------------------------------------------------------- */
/* Tables / DataTables polish                                              */
/* ---------------------------------------------------------------------- */
.table { --bs-table-bg: transparent; }
.table thead th {
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .05em;
  color: var(--vot-text-muted);
  border-bottom-width: 1px;
  background: var(--vot-blue-light);
}

.table-hover tbody tr:hover { background: var(--vot-blue-light); }

.avatar-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--vot-blue-light);
  color: var(--vot-blue);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.dataTables_wrapper .dt-buttons { margin-bottom: .75rem; }

/* ---------------------------------------------------------------------- */
/* Badges                                                                  */
/* ---------------------------------------------------------------------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 999px; }

/* ---------------------------------------------------------------------- */
/* Forms                                                                    */
/* ---------------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--vot-radius-sm);
  border-color: var(--vot-border);
  padding: .55rem .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--vot-blue);
  box-shadow: 0 0 0 .2rem rgba(11, 61, 145, .12);
}

.form-floating > label { color: var(--vot-text-muted); }

.section-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--vot-blue);
  font-weight: 800;
  border-bottom: 2px solid var(--vot-blue-light);
  padding-bottom: .5rem;
  margin-bottom: 1.1rem;
}

/* ---------------------------------------------------------------------- */
/* Misc                                                                     */
/* ---------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--vot-border) 25%, #f0f2f8 37%, var(--vot-border) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--vot-radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before {
  content: "";
  position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--vot-border);
}
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before {
  content: "";
  position: absolute; left: -1.75rem; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--vot-gold);
  box-shadow: 0 0 0 3px var(--vot-blue-light);
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--vot-success); }
.status-dot.offline { background: var(--vot-text-muted); }

.brand-footer {
  padding: 1.25rem 1.75rem;
  color: var(--vot-text-muted);
  font-size: .82rem;
  border-top: 1px solid var(--vot-border);
}

.stat-progress { height: 6px; border-radius: 999px; background: var(--vot-blue-light); overflow: hidden; }
.stat-progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--vot-blue), var(--vot-gold)); }

.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.error-page .error-code {
  font-size: 6.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--vot-blue), var(--vot-gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
