/* --------------------
 Global Styles
-------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  min-height: 100vh;
  background: #f4f6f9;
  color: #333;
  overflow-x: hidden;
}

/* --------------------
 Sidebar
-------------------- */
.sidebar {
  width: 250px;
  background: #1f2937;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  padding: 20px 0;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.sidebar .logo {
  text-align: center;
  margin-bottom: 30px;
}

.sidebar .logo img {
  width: 60px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.sidebar h2 {
  font-size: 18px;
}

.sidebar nav a {
  display: block;
  padding: 12px 20px;
  color: #d1d5db;
  text-decoration: none;
  font-size: 15px;
  transition: 0.3s;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #374151;
  color: #fff;
  border-left: 3px solid #3b82f6;
}

.sidebar.closed {
  transform: translateX(-100%);
}

/* --------------------
 Main Content
-------------------- */
.main-content {
  margin-left: 250px;
  padding: 20px;
  flex: 1;
  transition: margin-left 0.3s ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 20px;
  color: #1f2937;
}

.topbar .menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  transition: 0.3s;
}

.topbar .menu-toggle:hover {
  color: #3b82f6;
  transform: rotate(90deg);
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .user-info img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
}

/* --------------------
 Overlay
-------------------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  z-index: 900;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* --------------------
 Cards
-------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #555;
}

.card p {
  font-size: 20px;
  font-weight: bold;
  color: #111;
}

/* --------------------
 Charts
-------------------- */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: 0.3s;
}

.chart-card:hover {
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.25);
}

/* --------------------
 Tables
-------------------- */
.table-section {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.table-section h2 {
  margin-bottom: 15px;
}

.table-section table {
  width: 100%;
  border-collapse: collapse;
}

.table-section th,
.table-section td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #eee;
  transition: background 0.3s;
}

.table-section th {
  background: #f9fafb;
  font-size: 14px;
  color: #555;
}

.table-section tbody tr:hover {
  background: #f1f5f9;
  cursor: pointer;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
}

.status.active { background-color: #22c55e; }
.status.inactive { background-color: #ef4444; }
.status.pending { background-color: #eab308; color: #111; }

/* Role badges */
.role {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
}

.role.admin { background-color: #3b82f6; }
.role.user { background-color: #6b7280; }
.role.manager { background-color: #9333ea; }

/* --------------------
 Buttons
-------------------- */
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: 0.3s;
}

.btn-add { background: #3b82f6; color: white; }
.btn-add:hover { background: #2563eb; }

.btn-edit { background: #f59e0b; color: white; }
.btn-edit:hover { background: #d97706; }

.btn-delete { background: #ef4444; color: white; }
.btn-delete:hover { background: #dc2626; }

/* --------------------
 Modal (Unified System)
-------------------- */
#editModal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

#editModal.hidden {
  display: none;
}

#editModal .modal-content {
  background: #fff;
  color: #000;
  padding: 20px;
  border-radius: 12px;
  min-width: 320px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#editModal h2 {
  margin-top: 0;
  font-size: 20px;
  font-weight: 600;
}

#editModal input,
#editModal select {
  width: 100%;
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

#editModal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
}

#editModal button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#saveEdit {
  background: #2563eb;
  color: #fff;
}

#closeModal {
  background: #e5e7eb;
  color: #111;
}
/* Modal (hidden by default) */
#editModal {
  display: none; /* keep hidden */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* Modal Content */
.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 400px;
  max-width: 90%;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s ease;
}
/* --------------------
 Settings Page
-------------------- */
.settings-form {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.settings-form h2 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #444;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  transition: 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.form-group.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group.checkbox input {
  width: auto;
}

/* Settings Page Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
}

.btn.primary {
  background: #3b82f6;
  color: #fff;
}

.btn.primary:hover {
  background: #2563eb;
}

.btn.secondary {
  background: #6b7280;
  color: #fff;
}

.btn.secondary:hover {
  background: #4b5563;
}

.btn.danger {
  background: #ef4444;
  color: #fff;
}

.btn.danger:hover {
  background: #dc2626;
}

/* --------------------
 Responsive
-------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .topbar .menu-toggle {
    display: block;
  }
}
