:root {
  /* Branding Colors */
  --primary: #4e73df;
  --primary-hover: #2e59d9;
  --success: #1cc88a;
  --info: #36b9cc;
  --warning: #f6c23e;
  --danger: #e74a3b;
  
  /* Transitions */
  --transition-base: all 0.2s ease-in-out;
}

/* LIGHT MODE (Default) */
:root, body, .theme-light {
  --bg-body: #f8f9fc;
  --content-bg: #f8f9fc;
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  
  --text-main: #5a5c69;
  --text-heading: #2e2f37;
  --text-muted: #858796;
  
  --border-color: #e3e6f0;
  --hr-border: #e3e6f0;
  
  --input-bg: #ffffff;
  --input-border: #d1d3e2;
  --input-text: #6e707e;
  
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f8f9fc;
  --dropdown-border: #e3e6f0;
  
  --shadow-sm: 0 .125rem .25rem 0 rgba(58,59,69,.05);
  --shadow-md: 0 .15rem 1.75rem 0 rgba(58,59,69,.15);

  /* Compatibility with existing code */
  --muted: var(--text-muted);
}

/* DARK MODE (Override) */
body.theme-dark {
  --bg-body: #0f172a;
  --content-bg: #0f172a;
  --card-bg: #1e293b;
  --sidebar-bg: #1e293b;
  --topbar-bg: #1e293b;
  
  --text-main: #94a3b8;
  --text-heading: #f1f5f9;
  --text-muted: #64748b;
  
  --border-color: #334155;
  --hr-border: #1e293b;
  
  --input-bg: #0f172a;
  --input-border: #334155;
  --input-text: #cbd5e1;
  
  --dropdown-bg: #1e293b;
  --dropdown-hover: #334155;
  --dropdown-border: #334155;

  --shadow-sm: 0 .125rem .25rem 0 rgba(0,0,0,.25);
  --shadow-md: 0 .15rem 1.75rem 0 rgba(0,0,0,.35);

  /* Compatibility */
  --muted: var(--text-muted);
}

/* Base Style Application */
body {
  background-color: var(--bg-body);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--text-heading);
}

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

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

/* THEME TOGGLE UI */
.theme-toggle {
  position: relative;
  width: 54px;
  height: 26px;
  background: rgba(0,0,0,0.08);
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  user-select: none;
  transition: var(--transition-base);
  border: 1px solid rgba(0,0,0,0.05);
}

body.theme-dark .theme-toggle {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.1);
}

.theme-toggle .icon {
  font-size: 12px;
  z-index: 2;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle .thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  left: 3px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 1;
}

/* Light mode thumb position (right) */
body.theme-light .theme-toggle .thumb {
  transform: translateX(26px);
}

/* Dark mode thumb position (left) */
body.theme-dark .theme-toggle .thumb {
  transform: translateX(0px);
}
