:root {
  --sidebar-bg: #1f2937; /* dark sidebar */
  --sidebar-text: #fff; /* sidebar text */
  --primary: #5b6cff; /* main buttons/ highlights */
  --card-bg: #fff; /* stats na d charts */
  --text-main: #111827; /* main text */
  --text-muted: #6b7280; /* paragraph / secondary color */
  --border-color: #e5e7eb; /* light borders if needed */
}

/* reset spacing so layout behaves predictably */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.light {
  --sidebar-bg: #f9fafb;
  --sidebar-text: #111827;
  --primary: #4f46e5;
  --card-bg: #fff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --background: #f3f4f6;
}

/* full screen */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-main);
  background: var(--background); /* light background for dashboard */
  height: 100vh;
}

/* main page grid */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr; /* sidebar | content */
  height: 100vh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.header-left h1 {
  margin-bottom: 5px;
  font-size: 22px;
  font-weight: 600;
}

.header-left p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.header-right {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer; /* style the buttons roughly */
}

.btn:hover {
  opacity: 0.9; /* simple hover effect for buttons */
}

.btn.primary {
  background: var(--primary); /* example primary color figma */
  color: #fff;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.sidebar .logo {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 30px;
}

.sidebar .menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sidebar .menu li {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
}

.sidebar .menu li:hover {
  background: #374151; /* slightly lighter on hover */
}

.sidebar-search {
  margin: 20px 0;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  outline: none;
  font-size: 14px;
  background: #374151; /* dark input background */
  color: #fff; /* white text for input */
}

.sidebar-search input::placeholder {
  color: #d1d5db; /* lighter placeholder text */
  font-style: italic;
}

.sidebar .menu ul {
  list-style: none;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.main {
  display: grid;
  grid-template-rows: 80px 1fr; /* header | dashboard */
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 cards in a row */
  gap: 20px; /* space between cards*/
  margin-bottom: 20px;
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.stats .card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  font-weight: 600;
}

.main-chart {
  margin-bottom: 20px;
}

.chart-card {
  height: 320px; /* match the main chart height */
  position: relative;
}

.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.mini-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 charts side by side */
  gap: 20px;
}

.mini-charts .chart {
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.mini-charts .chart h4 {
  margin-bottom: 10px;
  font-size: 14px;
}

.mini-charts .chart canvas {
  flex: 1;
  width: 100% !important;
  height: 100% !important;
}

.main-chart,
.mini-charts .chart {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar,
.header,
.card,
.chart {
  border: none;
  padding: 20px;
}

.content {
  padding: 20px; /* space around all dashboard content */
  display: flex;
  flex-direction: column;
  gap: 30px; /* vertical gap between stats, main chart, mini charts */
}

.menu-toggle {
  display: none;
  font-size: 22px;
  background: none;
  border: none;
  cursor: pointer;
  margin-right: 10px;
}

/* Tablet */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 200px 1fr; /* slightly narrower sidebar */
  }
  .stats {
    grid-template-columns: repeat(2, 1fr); /* 2 cards per row on tablet */
  }
  .mini-charts {
    grid-template-columns: 1fr; /* stack mini charts on tablet */
  }
}

/* Mobile */
@media (max-width: 700px) {
  .layout {
    grid-template-columns: 1fr; /* no sidebar column */
  }
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    background: var(--sidebar-bg);
    width: 240px;
    transition: left 0.3s ease;
    z-index: 1000;
  }
  .sidebar.active {
    left: 0; /* show sidebar when active */
  }
  .main {
    grid-column: 1/-1;
  }
  .stats {
    grid-template-columns: 1fr; /* 1 card per row on mobile */
  }
}

/* show only on mobile */
@media (max-width: 700px) {
  .menu-toggle {
    display: block;
  }
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4); /* semi-transparent black */
  opacity: 0;
  pointer-events: none; /* allow clicks to pass through when not active */
  transition: opacity 0.3s ease;
  z-index: 900; /* below the sidebar */
}

/* when sidebar opens */
.overlay.active {
  opacity: 1;
  pointer-events: all; /* block clicks when active */
}
