:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e3a2f;
  --sidebar-hover: #284c3e;
  --sidebar-active: #4caf50;
  --sidebar-text: #f1f5f9;
  --sidebar-text-muted: #a8c5b8;

  --header-height: 60px;
  --header-bg: #ffffff;

  --content-bg: #f0f7f4;

  --primary-color: #4caf50;
  --primary-hover: #388e3c;

  --text-main: #1a2e26;
  --text-muted: #5c756d;

  --border-color: #e2e8e5;
  --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--content-bg);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Layout Structure */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  transition: all 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  letter-spacing: 1px;
}

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

.nav-section-title {
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: white;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 0.25rem;
  opacity: 0.9;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  transition: all 0.2s;
  gap: 0.75rem;
  font-size: 0.9375rem;
}

.nav-link-custom:hover {
  background-color: var(--sidebar-hover);
  color: white;
}

.nav-link-custom.active {
  background-color: var(--sidebar-active);
  color: white;
}

.nav-link-custom i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  height: var(--header-height);
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

.page-container {
  padding: 2rem;
  flex: 1;
}

/* Components */
.card-custom {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.btn-primary-custom {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
}

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

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-main);
}

.text-muted-custom {
  color: var(--text-muted);
}

/* Tables */
.table-custom {
  width: 100%;
  border-collapse: collapse;
}

.table-custom th {
  background-color: #f8fafc;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.table-custom td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.table-custom tr:hover {
  background-color: #f1f5f9;
}

/* Footer */
.footer {
  background-color: var(--header-bg);
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
  margin-top: auto;
  width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px 0 rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  /* Overlay for mobile */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

/* Desktop toggle behavior (optional, if we want to collapse on desktop too) */
@media (min-width: 769px) {
  .sidebar.collapsed {
    width: 0;
    overflow: hidden;
  }

  .main-content.expanded {
    margin-left: 0;
  }
}

/* Responsive Scaling */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 220px;
    --header-height: 50px;
  }

  body {
    font-size: 0.95rem;
  }

  .page-container {
    padding: 1.5rem;
  }

  .card-custom {
    padding: 1.25rem;
  }

  .nav-link-custom {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.25rem;
  }
  h4 {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 50px; /* Keep compact header */
  }

  body {
    font-size: 0.9rem;
  }

  .page-container {
    padding: 1rem;
  }

  .card-custom {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .sidebar-brand {
    font-size: 1.1rem;
  }

  .btn-primary-custom {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .table-custom th,
  .table-custom td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
}
