@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  --primary: #065f46;
  --primary-light: #047857;
  --primary-dark: #064e3b;
  --primary-subtle: #ecfdf5;
  --accent: #d97706;
  --accent-light: #f59e0b;
  --accent-subtle: #fffbeb;
  
  --sidebar-bg: #09261e;
  --sidebar-hover: #123d32;
  --sidebar-active: #047857;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(6, 95, 70, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

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

.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.sidebar-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-title p {
  font-size: 11px;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.menu-category {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--sidebar-muted);
  padding: 14px 12px 6px 12px;
  letter-spacing: 0.08em;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.menu-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--sidebar-muted);
  transition: color 0.2s ease;
}

.menu-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.menu-item:hover i {
  color: var(--accent-light);
}

.menu-item.active {
  background: linear-gradient(90deg, var(--primary-light) 0%, var(--primary) 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
}

.menu-item.active i {
  color: #ffffff;
}

.badge-counter {
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
}

/* ========================================================
   Sidebar Collapsible Dropdown Menu Styles
   ======================================================== */
.menu-dropdown {
  position: relative;
  margin-bottom: 3px;
}

.menu-dropdown-toggle {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  user-select: none;
}

.menu-dropdown-toggle .menu-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-dropdown-toggle .dropdown-arrow {
  font-size: 11px;
  width: 14px;
  text-align: center;
  color: var(--sidebar-muted);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.menu-dropdown.open > .menu-dropdown-toggle {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.menu-dropdown.open > .menu-dropdown-toggle .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--accent-light);
}

.menu-dropdown.active-parent > .menu-dropdown-toggle {
  color: #ffffff;
  background: rgba(4, 120, 87, 0.22);
  border-left: 3px solid var(--accent);
}

.menu-dropdown.active-parent > .menu-dropdown-toggle i {
  color: var(--accent-light);
}

.submenu-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-dropdown.open > .submenu-wrapper {
  grid-template-rows: 1fr;
}

.submenu-content {
  overflow: hidden;
  padding-left: 12px;
  margin-left: 20px;
  border-left: 1.5px solid rgba(255, 255, 255, 0.12);
  margin-top: 3px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  position: relative;
}

.submenu-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.submenu-item i {
  font-size: 13px;
  width: 16px;
  text-align: center;
  color: var(--sidebar-muted);
  transition: all 0.2s ease;
}

.submenu-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  padding-left: 15px;
}

.submenu-item:hover i {
  color: var(--accent-light);
}

.submenu-item.active {
  background: linear-gradient(90deg, rgba(4, 120, 87, 0.85) 0%, rgba(6, 95, 70, 0.95) 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.35);
}

.submenu-item.active i {
  color: #ffffff;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Navbar */
.top-navbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-toggle-sidebar {
  background: none;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-toggle-sidebar:hover {
  background: var(--bg-body);
}

.nav-search {
  position: relative;
  width: 320px;
}

.nav-search input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background: var(--bg-body);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

.nav-search input:focus {
  border-color: var(--primary-light);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.1);
}

.nav-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.user-badge:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-light);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.user-info {
  text-align: left;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

/* ========================================================
   Navbar Popups & Dropdown Actions
   ======================================================== */
.nav-dropdown {
  position: relative;
}

.dropdown-menu-popup {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 270px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 8px;
  z-index: 1050;
  display: none;
  animation: dropdownFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dropdown-menu-popup.show {
  display: block;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-header {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.18s ease;
}

.dropdown-item i {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-item .item-text {
  display: flex;
  flex-direction: column;
}

.dropdown-item .item-title {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.dropdown-item .item-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.dropdown-item:hover {
  background: var(--bg-body);
}

.dropdown-item:hover .item-title {
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

/* Page Content */
.content-body {
  padding: 28px;
  flex: 1;
}

/* Breadcrumbs & Header */
.page-title-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-box h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-title-box p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Cards & Statistics */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-info h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

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

.stat-icon.emerald { background: var(--primary-subtle); color: var(--primary); }
.stat-icon.amber { background: var(--accent-subtle); color: var(--accent); }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.rose { background: #ffe4e6; color: #e11d48; }

/* Content Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 24px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

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

.table-custom td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 30px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(6, 95, 70, 0.25);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-light);
}

.btn-outline {
  border-color: var(--border-color);
  background: #fff;
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--bg-body);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }

/* Forms */
.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.1);
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    left: -280px;
    height: 100vh;
  }
  .sidebar.show {
    left: 0;
  }
  .nav-search {
    display: none;
  }
}
