/* =========================================================
   Dengue Prediction System — Main Stylesheet
   Design System v2.0
   ========================================================= */

/* ----- Custom Properties ----- */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --orange: #f97316;

  --dark-bg: #0f172a;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #0ea5e9;
  --sidebar-width: 280px;
  --topbar-height: 60px;

  --card-bg: #ffffff;
  --body-bg: #f1f5f9;
  --border-color: #e2e8f0;

  --text-primary: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: all 0.2s ease;
  --transition-slow: all 0.35s ease;
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--body-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

img { max-width: 100%; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--body-bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =========================================================
   SIDEBAR LAYOUT
   ========================================================= */

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--text-white);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 72px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--topbar-height);
  text-decoration: none;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition-slow);
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.5);
  display: block;
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

/* Nav scroll area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

/* Section label */
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  padding: 10px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition-slow);
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

/* Nav item */
.nav-item-wrapper { position: relative; }

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-link-item:hover {
  background-color: var(--sidebar-hover);
  color: var(--text-white);
  border-left-color: rgba(14, 165, 233, 0.5);
  text-decoration: none;
}

.nav-link-item.active {
  background-color: rgba(14, 165, 233, 0.15);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-link-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-link-item .nav-text {
  font-size: 13.5px;
  transition: var(--transition-slow);
}

.sidebar.collapsed .nav-link-item .nav-text { opacity: 0; width: 0; }
.sidebar.collapsed .nav-link-item { padding: 10px 26px; }

/* Submenu */
.nav-submenu {
  background-color: rgba(0, 0, 0, 0.15);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.nav-submenu.open { max-height: 300px; }

.nav-submenu .nav-link-item {
  padding-left: 52px;
  font-size: 13px;
  border-left: none;
  padding-top: 8px;
  padding-bottom: 8px;
}

.nav-submenu .nav-link-item.active {
  color: var(--primary);
  background-color: rgba(14, 165, 233, 0.1);
}

.nav-link-item .submenu-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.nav-link-item.submenu-open .submenu-arrow { transform: rotate(90deg); }

/* Sidebar bottom: user info + collapse btn */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  transition: var(--transition-slow);
}

.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user-avatar { display: none; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 12px 0; }

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover { color: white; background: rgba(255,255,255,0.1); }

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-link-item { position: relative; }

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 1040;
  transition: left var(--transition-slow);
  box-shadow: var(--shadow-sm);
}

.topbar.sidebar-collapsed { left: 72px; }

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar-hamburger:hover { background: var(--body-bg); }

/* Breadcrumb */
.topbar-breadcrumb {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb {
  margin: 0;
  padding: 0;
  background: none;
  font-size: 13px;
}

.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* Topbar actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1051;
}

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--body-bg);
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
  position: relative;
}

.topbar-btn:hover { background: var(--border-color); color: var(--text-primary); }

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 2px solid white;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
}

.topbar-user:hover { background: var(--body-bg); }

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: white;
  font-weight: 600;
}

.topbar-username { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* =========================================================
   MAIN CONTENT AREA
   ========================================================= */

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 0;
  width: calc(100% - var(--sidebar-width));
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition-slow), width var(--transition-slow);
}

.main-content.sidebar-collapsed {
  margin-left: 72px;
  width: calc(100% - 72px);
}

.content-inner {
  padding: 24px 28px 70px;
  width: 100%;
  box-sizing: border-box;
}

/* =========================================================
   PUBLIC CONTENT AREA (no sidebar)
   ========================================================= */

.public-content {
  width: 94%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 36px 0 80px;
}

/* When inside authenticated sidebar layout, reset public-content */
.main-content .public-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* =========================================================
   PAGE HEADER
   ========================================================= */

/* Page header */
.page-header {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

/* =========================================================
   GRID UTILITIES
   ========================================================= */

.grid { display: grid; gap: 16px; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 24px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.grid-no-mb { margin-bottom: 0 !important; }

/* Inline grids inside cards (forms, small layouts) — no bottom margin */
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-3-2, .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid-3, .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-3-2, .grid-2-1 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .public-content { width: 96%; padding: 24px 0 80px; }
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* =========================================================
   CARD COMPONENTS
   ========================================================= */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
}

.card-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-header-actions { margin-left: auto; display: flex; gap: 8px; }

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #fafbfc;
}

/* Stat cards */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card.border-left-primary { border-left: 4px solid var(--primary); }
.stat-card.border-left-success { border-left: 4px solid var(--success); }
.stat-card.border-left-warning { border-left: 4px solid var(--warning); }
.stat-card.border-left-danger  { border-left: 4px solid var(--danger); }
.stat-card.border-left-secondary { border-left: 4px solid var(--secondary); }
.stat-card.border-left-orange { border-left: 4px solid var(--orange); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.icon-primary   { background: #e0f2fe; color: var(--primary); }
.stat-icon.icon-success   { background: #d1fae5; color: var(--success); }
.stat-icon.icon-warning   { background: #fef3c7; color: var(--warning); }
.stat-icon.icon-danger    { background: #fee2e2; color: var(--danger); }
.stat-icon.icon-secondary { background: #ede9fe; color: var(--secondary); }
.stat-icon.icon-orange    { background: #ffedd5; color: var(--orange); }

.stat-content { flex: 1; min-width: 0; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Gradient stat cards (hero variants) */
.stat-card-gradient {
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.stat-card-gradient::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
}

.stat-card-gradient .stat-value { color: white; font-size: 32px; }
.stat-card-gradient .stat-label { color: rgba(255,255,255,0.8); }

.gradient-blue   { background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%); }
.gradient-violet { background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%); }
.gradient-green  { background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%); }
.gradient-amber  { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); }

/* Quick Action cards */
.action-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
}

.action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
  color: var(--text-primary);
  text-decoration: none;
}

.action-card .action-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.action-card .action-title { font-weight: 600; font-size: 14px; }
.action-card .action-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* =========================================================
   TABLES
   ========================================================= */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background-color: #f8fafc; }

.data-table.striped tbody tr:nth-child(even) { background: #fafbfc; }

.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.table-empty i { font-size: 40px; margin-bottom: 12px; display: block; opacity: 0.4; }

/* Table search */
.table-search {
  position: relative;
  max-width: 280px;
}

.table-search input {
  padding-left: 36px;
  width: 100%;
}

.table-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

/* =========================================================
   BADGES & RISK INDICATORS
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-primary   { background: #e0f2fe; color: #0369a1; }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-orange    { background: #ffedd5; color: #9a3412; }
.badge-violet    { background: #ede9fe; color: #5b21b6; }

/* Risk badges */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.risk-badge.risk-low       { background: #d1fae5; color: #065f46; }
.risk-badge.risk-medium    { background: #fef3c7; color: #92400e; }
.risk-badge.risk-high      { background: #ffedd5; color: #9a3412; }
.risk-badge.risk-very-high,
.risk-badge.risk-very_high { background: #fee2e2; color: #991b1b; }
.risk-badge.risk-alert     { background: #fee2e2; color: #991b1b; }
.risk-badge.risk-no_alert,
.risk-badge.risk-no-alert  { background: #d1fae5; color: #065f46; }

.risk-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  flex-shrink: 0;
}

.risk-dot.low       { background: var(--success); }
.risk-dot.medium    { background: var(--warning); }
.risk-dot.high      { background: var(--orange); }
.risk-dot.very-high,
.risk-dot.very_high { background: var(--danger); }
.risk-dot.alert {
  background: var(--danger);
  /* Reset Bootstrap .alert overrides */
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  display: inline-block;
  flex-shrink: 0;
}
.risk-dot.no_alert,
.risk-dot.no-alert  { background: var(--success); }

/* Status indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot.green  { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red    { background: var(--danger); }
.status-dot.grey   { background: #94a3b8; }

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; text-decoration: none; }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; color: white; text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: white; text-decoration: none; }

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}
.btn-warning:hover { background: #d97706; border-color: #d97706; color: white; text-decoration: none; }

.btn-secondary {
  background: #64748b;
  color: white;
  border-color: #64748b;
}
.btn-secondary:hover { background: #475569; border-color: #475569; color: white; text-decoration: none; }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: white; text-decoration: none; }

.btn-outline-secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}
.btn-outline-secondary:hover { background: var(--body-bg); color: var(--text-primary); text-decoration: none; }

.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; }
.btn-xl  { padding: 14px 30px; font-size: 16px; }
.btn-w   { width: 100%; justify-content: center; }

/* Loading state */
.btn.loading { pointer-events: none; opacity: 0.75; }
.btn.loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  margin-right: 4px;
}

/* =========================================================
   FORMS
   ========================================================= */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  background: white;
  transition: var(--transition);
  font-family: inherit;
  line-height: 1.5;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-control::placeholder { color: #94a3b8; }

textarea.form-control { resize: vertical; min-height: 90px; }

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.input-icon-wrapper .form-control { padding-left: 38px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check-input {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-check-label { font-size: 13.5px; cursor: pointer; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }

/* Input group */
.input-group {
  display: flex;
}

.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn           { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border: 1.5px solid var(--primary); }

.input-group-text {
  padding: 9px 12px;
  background: var(--body-bg);
  border: 1.5px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-muted);
}

/* =========================================================
   MODALS
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(2px);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--body-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: var(--border-color); color: var(--text-primary); }

.modal-body    { padding: 20px; }
.modal-footer  { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: slideInRight 0.3s ease;
  position: relative;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-danger  { border-left-color: var(--danger); }
.toast.toast-info    { border-left-color: var(--primary); }

.toast.hiding { animation: slideOutRight 0.3s ease forwards; }

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-danger  .toast-icon { color: var(--danger); }
.toast-info    .toast-icon { color: var(--primary); }

.toast-content { flex: 1; }
.toast-title   { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.toast-message { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  transition: var(--transition);
  flex-shrink: 0;
}

.toast-close:hover { color: var(--text-primary); }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 0 var(--radius);
  animation: toastProgress 4s linear forwards;
}

.toast-success .toast-progress { background: var(--success); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-danger  .toast-progress { background: var(--danger); }

/* =========================================================
   PROGRESS BARS
   ========================================================= */

.progress-bar-wrapper { margin-bottom: 12px; }

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 5px;
}

.progress-bar-label .label-name  { font-weight: 500; }
.progress-bar-label .label-value { color: var(--text-muted); }

.progress-track {
  height: 8px;
  background: var(--body-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s ease;
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

/* =========================================================
   TIMELINE (LOGS)
   ========================================================= */

.timeline { padding-left: 8px; }

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item:last-child::before { display: none; }

.timeline-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-icon.success { background: #d1fae5; color: var(--success); }
.timeline-icon.danger  { background: #fee2e2; color: var(--danger); }
.timeline-icon.warning { background: #fef3c7; color: var(--warning); }
.timeline-icon.info    { background: #e0f2fe; color: var(--primary); }

.timeline-content { flex: 1; }

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.timeline-title { font-weight: 600; font-size: 13.5px; }
.timeline-time  { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.timeline-body  { font-size: 13px; color: var(--text-muted); }

/* =========================================================
   CHARTS
   ========================================================= */

.chart-container {
  position: relative;
  width: 100%;
}

/* Do NOT constrain canvas width/height — Chart.js manages it */
.chart-container canvas { display: block; }

/* =========================================================
   LOADING / SKELETON
   ========================================================= */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.loading-text { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* =========================================================
   HERO SECTION (Public Landing)
   ========================================================= */

.hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0ea5e9 100%);
  min-height: 520px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.12);
  pointer-events: none;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 350px;
  height: 350px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.1);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; padding: 60px 0; }

.hero-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  color: white;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-title .highlight { color: var(--primary); }

.hero-subtitle {
  font-size: 17px;
  color: rgba(255,255,255,0.75);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.hero-stat-item { text-align: center; }

.hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: white;
  display: block;
}

.hero-stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-hero-primary {
  background: var(--primary);
  color: white;
  padding: 13px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-hero-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-2px); text-decoration: none; }

.btn-hero-outline {
  background: rgba(255,255,255,0.1);
  color: white;
  padding: 13px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(4px);
}

.btn-hero-outline:hover { background: rgba(255,255,255,0.2); color: white; text-decoration: none; }

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.hero-badge-float {
  position: absolute;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: white;
  font-size: 12px;
  font-weight: 500;
}

/* Feature cards */
.feature-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: var(--transition-slow);
  border: 1px solid var(--border-color);
  height: 100%;
}

.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.feature-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
}

.feature-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.feature-desc  { font-size: 13.5px; color: var(--text-muted); line-height: 1.7; }

/* Regency cards */
.regency-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: default;
}

.regency-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

.regency-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.regency-meta { font-size: 12px; color: var(--text-muted); }

/* Steps */
.steps-list { display: flex; flex-direction: column; gap: 20px; }

.step-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content { flex: 1; }
.step-title   { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.step-desc    { font-size: 13.5px; color: var(--text-muted); }

/* =========================================================
   PUBLIC TOPNAV (unauthenticated pages)
   ========================================================= */

.public-navbar {
  background: var(--dark-bg);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.public-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
}

.public-navbar-brand:hover { color: white; text-decoration: none; }

.public-navbar-links { display: flex; align-items: center; gap: 4px; }

.public-nav-link {
  padding: 8px 14px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
}

.public-nav-link:hover { background: rgba(255,255,255,0.08); color: white; text-decoration: none; }
.public-nav-link.active { color: var(--primary); }

.public-navbar-actions { display: flex; align-items: center; gap: 8px; }

/* =========================================================
   AUTH PAGE
   ========================================================= */

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

.auth-left {
  flex: 1;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #0369a1 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.1);
}

.auth-left::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -60px;
  width: 300px;
  height: 300px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.1);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
  position: relative;
  z-index: 1;
}

.auth-brand-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.auth-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.auth-brand-sub { font-size: 11px; color: rgba(255,255,255,0.45); }

.auth-headline {
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 800;
  color: white;
  line-height: 1.2;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.auth-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 380px;
  position: relative;
  z-index: 1;
}

.auth-features { position: relative; z-index: 1; }

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}

.auth-feature-item i {
  width: 28px;
  height: 28px;
  background: rgba(14,165,233,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 13px;
  flex-shrink: 0;
}

.auth-right {
  width: 440px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  background: white;
}

.auth-form-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-form-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }

.demo-creds {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 20px;
}

.demo-creds-title { font-size: 12px; font-weight: 600; color: #0369a1; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.demo-cred-row    { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; color: var(--text-muted); }
.demo-cred-row code { background: #e0f2fe; padding: 1px 6px; border-radius: 4px; font-size: 11px; color: #0369a1; }

/* =========================================================
   DATA STATUS TABLE
   ========================================================= */

.data-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
}

/* =========================================================
   ALERT BOX (inline messages)
   ========================================================= */

.alert-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 16px;
}

.alert-box.info    { background: #f0f9ff; border-color: var(--primary); }
.alert-box.success { background: #f0fdf4; border-color: var(--success); }
.alert-box.warning { background: #fffbeb; border-color: var(--warning); }
.alert-box.danger  { background: #fef2f2; border-color: var(--danger); }

.alert-box .alert-icon { font-size: 17px; margin-top: 1px; flex-shrink: 0; }
.alert-box.info .alert-icon    { color: var(--primary); }
.alert-box.success .alert-icon { color: var(--success); }
.alert-box.warning .alert-icon { color: var(--warning); }
.alert-box.danger .alert-icon  { color: var(--danger); }

.alert-box .alert-text { font-size: 13.5px; }
.alert-box .alert-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }

/* =========================================================
   TABS
   ========================================================= */

.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =========================================================
   PIPELINE STEPS (NDVI)
   ========================================================= */

.pipeline-steps { display: flex; flex-direction: column; gap: 0; }

.pipeline-step {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.pipeline-step:last-child { border-bottom: none; }

.pipeline-step-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.pipeline-step-content { flex: 1; }
.pipeline-step-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pipeline-step-desc  { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* =========================================================
   FOOTER
   ========================================================= */

.app-footer {
  background: var(--sidebar-bg);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 14px;
  font-size: 12px;
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 100;
  transition: left var(--transition-slow);
}

.app-footer.sidebar-collapsed { left: 72px; }

.public-footer {
  background: var(--dark-bg);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 20px;
  font-size: 12px;
}

/* =========================================================
   UTILS
   ========================================================= */

.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning) !important; }
.text-danger    { color: var(--danger) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-white     { color: white !important; }

.bg-primary  { background-color: var(--primary) !important; }
.bg-success  { background-color: var(--success) !important; }
.bg-warning  { background-color: var(--warning) !important; }
.bg-danger   { background-color: var(--danger) !important; }
.bg-dark     { background-color: var(--dark-bg) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.mb-0  { margin-bottom: 0 !important; }
.mb-4  { margin-bottom: 4px !important; }
.mb-8  { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mt-4  { margin-top: 4px !important; }
.mt-8  { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-20 { margin-top: 20px !important; }
.mt-24 { margin-top: 24px !important; }

.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.section-subheading {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 24px 0;
}

.pill {
  display: inline-block;
  background: var(--body-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--primary-dark);
}

pre {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.6;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease; }
.count-up { animation: countUp 0.6s ease; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

/* --- Large screens (1440–1799px) --- */
@media (min-width: 1440px) {
  .content-inner { padding: 28px 40px 70px; }
}

/* --- Very large screens (≥1800px, e.g. 2056px) --- */
@media (min-width: 1800px) {
  .content-inner { padding: 32px 60px 80px; }
  .page-title    { font-size: 24px; }
  .page-header   { margin-bottom: 28px; }
}

@media (max-width: 1024px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 40px 32px; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .topbar {
    left: 0;
  }

  .topbar-hamburger { display: flex; }

  .main-content { margin-left: 0; }
  .content-inner { padding: 20px 16px 70px; }

  .app-footer { left: 0; }

  .hero-section { min-height: auto; }
  .hero-content { padding: 40px 0; }

  .public-navbar { padding: 0 16px; }
  .public-navbar-links { display: none; }
  .public-nav-hamburger { display: flex !important; }

  .auth-right { padding: 32px 20px; }
}

@media (max-width: 480px) {
  .stat-card  { padding: 14px; }
  .stat-value { font-size: 22px; }
  .hero-stats { gap: 20px; }
  .hero-stat-value { font-size: 22px; }
}

/* ── Mobile overflow & layout fixes ─────────────────────────── */
@media (max-width: 768px) {
  /* Prevent any element from causing horizontal scroll */
  .main-content,
  .content-inner,
  .public-content,
  .card,
  .card-body,
  .card-header,
  .page-header {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Tables: scrollable on mobile */
  .table-responsive,
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* Page header: stack vertically */
  .page-header.d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  /* Charts: limit height on mobile */
  .chart-container { height: 200px !important; }

  /* Buttons: smaller on mobile */
  .btn { font-size: 12px; padding: 6px 12px; }

  /* Hide non-essential columns in tables */
  .d-none-mobile { display: none !important; }

  /* Stat cards: 2 columns on mobile */
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Content padding */
  .content-inner { padding: 16px 12px 70px; }
}

/* ── Public Mobile Menu ──────────────────────────────────────── */
.public-nav-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: white;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
}
.public-nav-hamburger:hover { background: rgba(255,255,255,0.1); }

.public-mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--sidebar-bg, #0f172a);
  padding: 8px 16px 16px;
  gap: 4px;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 1025;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.public-mobile-menu.open { display: flex; }

.public-mobile-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  transition: all .15s;
}
.public-mobile-link:hover,
.public-mobile-link.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* ── Language Toggle ─────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  align-items: center;
  background: var(--body-bg, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 20px;
  padding: 2px;
  gap: 0;
  flex-shrink: 0;
}
.lang-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-muted, #64748b);
  transition: all .15s;
  white-space: nowrap;
}
.lang-opt.lang-active {
  background: var(--primary, #0ea5e9);
  color: #fff;
}

@media (max-width: 480px) {
  .lang-opt { padding: 3px 7px; gap: 2px; }
  .lang-label { display: none; }
}
