/* ========================================
   ADMIN PANEL STYLES
   ======================================== */

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

body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
}

/* ========================================
   HEADER
   ======================================== */

.admin-header {
  background: #2c3e50;
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-left .logo {
  height: 40px;
}

.header-left h1 {
  font-size: 22px;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.admin-name {
  font-weight: 600;
  padding: 8px 15px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
}

/* ========================================
   BUTTONS
   ======================================== */

button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: #2ecc71;
  color: white;
}

.btn-success:hover {
  background: #27ae60;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.admin-container {
  display: flex;
  height: calc(100vh - 70px);
}

/* ========================================
   SIDEBAR
   ======================================== */

.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 25px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  font-size: 15px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item .icon {
  font-size: 20px;
}

.nav-item:hover {
  background: #f0f7ff;
  border-left-color: #3498db;
}

.nav-item.active {
  background: #e8f4ff;
  border-left-color: #3498db;
  color: #3498db;
  font-weight: 600;
}

/* ========================================
   CONTENT AREA
   ======================================== */

.admin-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section h2 {
  font-size: 28px;
  margin-bottom: 25px;
  color: #2c3e50;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

/* ========================================
   STATS GRID (Dashboard)
   ======================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon {
  font-size: 40px;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f7ff;
  border-radius: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #2c3e50;
}

.stat-label {
  font-size: 14px;
  color: #7f8c8d;
  margin-top: 5px;
}

/* ========================================
   CHART CARD
   ======================================== */

.dashboard-charts {
  display: grid;
  gap: 20px;
}

.chart-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-card h3 {
  font-size: 18px;
  margin-bottom: 15px;
  color: #2c3e50;
}

#recent-activity {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #555;
}

.activity-item:last-child {
  border-bottom: none;
}

/* ========================================
   SEARCH BAR
   ======================================== */

.search-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.search-bar input[type="text"] {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

.search-bar select {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

/* ========================================
   DATA TABLE
   ======================================== */

.data-table {
  width: 100%;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.data-table thead {
  background: #34495e;
  color: white;
}

.data-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
}

.data-table td {
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .loading {
  text-align: center;
  padding: 30px;
  color: #999;
}

.data-table .actions {
  display: flex;
  gap: 8px;
}

.data-table .actions button {
  padding: 5px 12px;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-guest {
  background: #ecf0f1;
  color: #7f8c8d;
}

.badge-member {
  background: #d1f2eb;
  color: #1abc9c;
}

.badge-moderator {
  background: #ffeaa7;
  color: #fdcb6e;
}

.badge-admin {
  background: #fab1a0;
  color: #e17055;
}

.badge-superadmin {
  background: #a29bfe;
  color: #6c5ce7;
}

.badge-active {
  background: #d5f4e6;
  color: #27ae60;
}

.badge-banned {
  background: #fadbd8;
  color: #c0392b;
}

/* ========================================
   MODULES GRID
   ======================================== */

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.module-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.module-header h3 {
  font-size: 16px;
  color: #2c3e50;
}

.module-toggle {
  position: relative;
  width: 50px;
  height: 26px;
}

.module-toggle input {
  display: none;
}

.module-toggle label {
  display: block;
  width: 100%;
  height: 100%;
  background: #ccc;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s;
}

.module-toggle input:checked + label {
  background: #2ecc71;
}

.module-toggle label:after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.module-toggle input:checked + label:after {
  transform: translateX(24px);
}

.module-description {
  font-size: 14px;
  color: #7f8c8d;
}

/* ========================================
   LOGS CONTAINER
   ======================================== */

.logs-container {
  background: #2c3e50;
  color: #ecf0f1;
  border-radius: 10px;
  padding: 20px;
  max-height: 600px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.logs-container pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 10px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: Arial, sans-serif;
}

.form-group textarea {
  resize: vertical;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}

.error-message.show {
  display: block;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .admin-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .nav-item {
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: #3498db;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .header-left h1 {
    font-size: 18px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 10px;
  }
}
