/* ===================================================================
   NEXIX SECURITY LABS - Modern Admin Dashboard CSS
   Modernized to match User Dashboard Aesthetics
   =================================================================== */

/* ===== CSS VARIABLES (Matching User Dashboard) ===== */
:root {
  /* Brand Colors */
  --primary-color: #131061;
  --primary-light: #2d2a8c;
  --primary-dark: #0a0833;
  --accent-color: #9fef00;
  --accent-hover: #85c200;

  /* Status Colors */
  --danger-color: #e74c3c;
  --danger-hover: #c0392b;
  --success-color: #2ecc71;
  --success-hover: #27ae60;
  --warning-color: #f39c12;
  --warning-hover: #e67e22;
  --info-color: #3498db;
  --info-hover: #2980b9;

  /* Light Theme */
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --border-color: #e1e8ed;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
}

[data-theme="dark"] {
  /* Dark Theme */
  --bg-primary: #1a1d29;
  --bg-secondary: #242837;
  --bg-tertiary: #2c3040;
  --text-primary: #e4e6eb;
  --text-secondary: #b0b3b8;
  --border-color: #3a3f51;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --sidebar-bg: #242837;
  --card-bg: #2c3040;
}

/* ===== GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

/* ===== HEADER STYLES ===== */
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid var(--accent-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
}

.logo i {
  font-size: 32px;
  color: var(--accent-color);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.user-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== SIDEBAR TOGGLE (MOBILE) ===== */
#sidebarToggle {
  position: fixed;
  top: 80px;
  left: 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s ease;
  display: none;
  box-shadow: var(--shadow-md);
}

#sidebarToggle:hover {
  background: var(--primary-light);
  transform: scale(1.05);
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
  display: flex;
  min-height: calc(100vh - 80px);
}

/* ===== SIDEBAR STYLES ===== */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  transition: all 0.3s ease;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  padding: 32px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  text-align: center;
  background: linear-gradient(135deg, rgba(159, 239, 0, 0.05), transparent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 15px;
}

.nav-item i {
  width: 20px;
  font-size: 18px;
  text-align: center;
}

.nav-item:hover {
  background: rgba(159, 239, 0, 0.08);
  border-left-color: var(--accent-color);
  color: var(--primary-color);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-left-color: var(--accent-color);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--accent-color);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 32px;
  background-color: var(--bg-primary);
  overflow-y: auto;
}

.content-page {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 20px;
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.section-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== REFRESH STATUS ===== */
.refresh-status {
  background: linear-gradient(135deg, var(--info-color), var(--info-hover));
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.refresh-status i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== BUTTONS ===== */
.btn, .action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.btn:hover, .action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active, .action-btn:active {
  transform: translateY(0);
}

.btn:disabled, .action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(19, 16, 97, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), var(--success-hover));
  color: white;
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), var(--danger-hover));
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-color), var(--warning-hover));
  color: white;
}

.btn-warning:hover {
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d, #5a6268);
  color: white;
}

.btn-secondary:hover {
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* ===== STATISTICS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

.stat-card.loading {
  justify-content: center;
  align-items: center;
  min-height: 140px;
}

.stat-icon {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
}

.stat-content h3 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-content p {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== TABLE STYLES ===== */
.table-container {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.table-header {
  background: linear-gradient(135deg, rgba(19, 16, 97, 0.03), transparent);
  padding: 24px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-title i {
  font-size: 24px;
  color: var(--accent-color);
}

.table-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.table-search {
  position: relative;
  display: flex;
  align-items: center;
}

.table-search i {
  position: absolute;
  left: 16px;
  color: var(--text-secondary);
  z-index: 1;
}

.table-search input {
  padding: 12px 16px 12px 48px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  width: 280px;
  transition: all 0.3s ease;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.table-search input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(159, 239, 0, 0.1);
}

.table-content {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

th {
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  font-weight: 600;
  color: var(--primary-color);
  position: sticky;
  top: 0;
  z-index: 10;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

tr {
  transition: background-color 0.2s ease;
}

tr:hover {
  background: rgba(159, 239, 0, 0.05);
}

/* ===== STATUS PILLS ===== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pill.approved,
.status-pill.verified {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-pill.pending {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning-color);
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.status-pill.running {
  background: rgba(52, 152, 219, 0.15);
  color: var(--info-color);
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.status-pill.stopped {
  background: rgba(149, 165, 166, 0.15);
  color: #95a5a6;
  border: 1px solid rgba(149, 165, 166, 0.3);
}

.status-pill i {
  font-size: 10px;
  animation: pulse 2s infinite;
}

/* ===== INSTANCE/USER INFO STYLES ===== */
.instance-id {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 13px;
  background: rgba(19, 16, 97, 0.08);
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--primary-color);
  border: 1px solid rgba(19, 16, 97, 0.15);
}

.victim-ip {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 14px;
  background: rgba(46, 204, 113, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--success-color);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.time-remaining {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--success-color);
  font-size: 14px;
}

.time-remaining.warning {
  color: var(--warning-color);
  animation: pulse 2s infinite;
}

/* ===== ACTIVITY LOGS ===== */
.activity-row {
  transition: all 0.2s ease;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 4px;
}

.activity-row:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.activity-row.login-activity {
  background-color: rgba(46, 204, 113, 0.08);
  border-left: 3px solid #2ecc71;
}

.activity-row.instance-activity {
  background-color: rgba(52, 152, 219, 0.08);
  border-left: 3px solid #3498db;
}

.activity-row.victim-activity {
  background-color: rgba(230, 126, 34, 0.08);
  border-left: 3px solid #e67e22;
}

.activity-row.admin-activity {
  background-color: rgba(231, 76, 60, 0.08);
  border-left: 3px solid #e74c3c;
}

.activity-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
  font-family: 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.03);
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid var(--border-color);
}

/* ===== MODALS ===== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 2001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  width: 100%;
}

.modal-header {
  padding: 28px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(159, 239, 0, 0.05), transparent);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  color: var(--primary-color);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
}

.modal-close,
.close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.modal-close:hover,
.close:hover {
  background: var(--danger-color);
  color: white;
  transform: rotate(90deg);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-tertiary);
}

/* ===== FORM STYLES ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.form-control,
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.form-control:focus,
.form-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(159, 239, 0, 0.1);
}

.form-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: block;
  line-height: 1.4;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.form-row .form-group {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: normal;
  gap: 8px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

textarea.form-control,
textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* ===== WARNING/INFO MESSAGES ===== */
.warning-message {
  background: rgba(243, 156, 18, 0.1);
  border-left: 4px solid var(--warning-color);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--warning-color);
  font-weight: 600;
}

.warning-message i {
  font-size: 24px;
}

.success-message {
  background: rgba(46, 204, 113, 0.1);
  border-left: 4px solid var(--success-color);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--success-color);
  font-weight: 600;
}

.success-message i {
  font-size: 24px;
}

.user-info,
.instance-info {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
  line-height: 1.8;
}

/* ===== USER DETAILS ===== */
.user-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.user-detail-item {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: 12px;
  border-left: 3px solid var(--accent-color);
}

.user-detail-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.user-detail-value {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(159, 239, 0, 0.2);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.no-data,
.no-instances-modern {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.no-data i,
.no-instances-modern i {
  font-size: 64px;
  color: var(--border-color);
  margin-bottom: 16px;
  display: block;
}

.no-data p,
.no-instances-modern p {
  font-size: 16px;
  font-weight: 500;
}

.error-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--danger-color);
  font-weight: 600;
}

.error-message i {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 100px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--card-bg);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent-color);
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.warning {
  border-left-color: var(--warning-color);
}

/* ===== BULK ACTIONS ===== */
.bulk-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  align-items: center;
  border: 1px solid var(--border-color);
}

.bulk-actions.hidden {
  display: none;
}

.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== PAGINATION ===== */
.pagination-container {
  padding: 20px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 16px 16px;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }
  
   .main-content {
    padding: 24px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  #sidebarToggle {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    z-index: 999;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .main-content {
    padding: 20px;
    margin-left: 0;
  }
  
  header {
    padding: 12px 20px;
  }
  
  .logo span {
    display: none;
  }
  
  .section-title {
    font-size: 24px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .table-search input {
    width: 100%;
  }
  
  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .modal {
    width: 95%;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 10px 16px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .section-actions {
    width: 100%;
  }
  
  .action-btn,
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== ADDITIONAL UTILITY CLASSES ===== */
.text-center {
  text-align: center;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-20 {
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

/* ===== ADMIN-SPECIFIC ENHANCEMENTS ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-admin {
  background: linear-gradient(135deg, var(--danger-color), var(--danger-hover));
  color: white;
}

.badge-verified {
  background: linear-gradient(135deg, var(--success-color), var(--success-hover));
  color: white;
}

.instance-details-grid,
.detail-card {
  margin-top: 20px;
}

.detail-card h4 {
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

[data-theme="dark"] .nav-item:hover {
  background-color: rgba(159, 239, 0, 0.1);
}

[data-theme="dark"] tr:hover {
  background: rgba(159, 239, 0, 0.08);
}

/* ===== ENHANCED SIDEBAR COMPONENTS ===== */

/* Sidebar Header Section */
.sidebar-header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px solid var(--border-color);
  background: linear-gradient(135deg, rgba(159, 239, 0, 0.05), transparent);
}

.sidebar-logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: all 0.3s ease;
}

.sidebar-logo-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.sidebar-logo-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Collapse Button */
.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(159, 239, 0, 0.1);
  color: var(--primary-color);
}

.sidebar-collapse-btn i {
  transition: transform 0.3s ease;
  font-size: 14px;
}

/* Sidebar Search */
.sidebar-search {
  padding: 16px;
  transition: all 0.3s ease;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.search-input-wrapper input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-input-wrapper input::placeholder {
  color: var(--text-secondary);
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(159, 239, 0, 0.1);
}

/* Sidebar Navigation Container */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Enhanced Navigation Items */
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  border-left: 3px solid transparent;
}

.nav-icon {
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon i {
  font-size: 18px;
  transition: all 0.2s ease;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.sidebar-nav .nav-item:hover {
  background: rgba(159, 239, 0, 0.08);
  color: var(--primary-color);
  transform: translateX(2px);
  border-left-color: var(--accent-color);
}

.sidebar-nav .nav-item.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  font-weight: 600;
  border-left-color: var(--accent-color);
  box-shadow: var(--shadow-sm);
}

.sidebar-nav .nav-item.active .nav-icon i {
  color: var(--accent-color);
}

/* Navigation Badges */
.nav-badge {
  padding: 3px 8px;
  background: var(--danger-color);
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--danger-color);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 2px solid var(--border-color);
  background: var(--bg-tertiary);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--success-color);
  border: 3px solid var(--card-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--bg-tertiary);
}

.profile-details {
  flex: 1;
  min-width: 0;
  transition: all 0.3s ease;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.profile-role {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 2px;
}

/* ===== COLLAPSED SIDEBAR STATES ===== */

.sidebar.collapsed {
  width: 80px;
}

/* Hide text elements when collapsed */
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .profile-details,
.sidebar.collapsed .sidebar-search {
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
}

/* Adjust collapsed button icon */
.sidebar.collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

/* Center items when collapsed */
.sidebar.collapsed .sidebar-header-section {
  justify-content: center;
  padding: 20px 10px;
}

.sidebar.collapsed .sidebar-logo-section {
  justify-content: center;
}

.sidebar.collapsed .sidebar-nav .nav-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-profile {
  justify-content: center;
  padding: 16px 10px;
}

/* Badge positioning when collapsed */
.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0;
  width: 18px;
  height: 18px;
  font-size: 10px;
  min-width: 18px;
}

/* Tooltips for collapsed state */
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 12px;
  background: var(--text-primary);
  color: white;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.sidebar.collapsed .nav-item::before {
  content: '';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 6px 5px 0;
  border-color: transparent var(--text-primary) transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 999;
}

.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .nav-item:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Adjust main content margin for collapsed sidebar */
.sidebar.collapsed ~ .main-content {
  margin-left: 80px;
}

/* ===== DARK MODE ADJUSTMENTS FOR SIDEBAR ===== */

[data-theme="dark"] .sidebar-header-section {
  background: linear-gradient(135deg, rgba(159, 239, 0, 0.08), transparent);
}

[data-theme="dark"] .sidebar-nav .nav-item:hover {
  background: rgba(159, 239, 0, 0.12);
}

[data-theme="dark"] .profile-status-dot {
  border-color: var(--card-bg);
  box-shadow: 0 0 0 1px var(--bg-secondary);
}

[data-theme="dark"] .search-input-wrapper input {
  background: var(--bg-secondary);
}

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

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: none;
  }
  
  .sidebar.collapsed {
    width: 280px;
  }
  
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .profile-details,
  .sidebar.collapsed .sidebar-search {
    opacity: 1;
    visibility: visible;
    width: auto;
  }
  
  .sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(0deg);
  }
}

/* ===== LAYOUT FIXES FOR PROPER PROPORTIONS ===== */

/* Ensure stat cards have proper minimum sizes */
.stat-card {
  min-height: 140px !important;
  padding: 28px !important;
}

.stat-icon {
  width: 70px !important;
  height: 70px !important;
  min-width: 70px;
  font-size: 32px !important;
}

.stat-content h3 {
  font-size: 36px !important;
  line-height: 1 !important;
  margin-bottom: 8px !important;
}

.stat-content p {
  font-size: 14px !important;
  line-height: 1.4 !important;
}

/* Ensure proper grid layout - don't let cards get too small */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 24px !important;
  margin-bottom: 40px !important;
}

/* On very large screens, limit to 3 columns max */
@media (min-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* Recent Activity Summary fixes */
.recent-activity-summary {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.recent-activity-summary h3 {
  margin-bottom: 20px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
}

#recentActivityList {
  max-height: 400px;
  overflow-y: auto;
}

.activity-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

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

.activity-summary-text {
  font-size: 14px !important;
  color: var(--text-primary);
  line-height: 1.6 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex: 1;
}

.activity-summary-text strong {
  color: var(--primary-color);
  font-weight: 600;
}

.activity-summary-time {
  font-size: 12px !important;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Main content proper spacing */
.main-content {
  min-height: calc(100vh - 80px);
  max-width: 1600px;
  width: 100%;
}

.content-page {
  width: 100%;
}

/* Section header improvements */
.section-header {
  margin-bottom: 32px !important;
}

.section-title {
  font-size: 32px !important;
  font-weight: 700 !important;
  margin-bottom: 8px !important;
}

.section-subtitle {
  font-size: 16px !important;
  color: var(--text-secondary);
}

/* Ensure proper spacing in dashboard */
#dashboardPage {
  padding: 0;
}

/* ===== LAYOUT FIX FOR PROPER ELEMENT SIZING ===== */

/* Ensure main content area adjusts properly for sidebar */
.dashboard {
  display: flex;
  min-height: calc(100vh - 80px);
  position: relative;
}

.main-content {
  flex: 1;
  padding: 32px;
  background-color: var(--bg-primary);
  overflow-y: auto;
  margin-left: 0;
  transition: margin-left 0.3s ease;
  width: 100%;
  min-width: 0;
}

/* Fix for section headers to prevent overflow */
.section-header {
  max-width: 100%;
  overflow: hidden;
}

.section-title {
  font-size: clamp(24px, 4vw, 32px);
  word-wrap: break-word;
}

/* Fix stats grid for proper responsiveness */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 24px;
  margin-bottom: 40px;
  width: 100%;
}

.stat-card {
  min-width: 0;
  overflow: hidden;
}

.stat-card h3 {
  font-size: clamp(28px, 5vw, 36px);
}

/* Fix tables to prevent horizontal overflow */
.table-container {
  width: 100%;
  overflow-x: auto;
}

table {
  min-width: 600px;
  width: 100%;
}

/* Fix modal sizing */
.modal {
  max-width: min(600px, 90vw);
  width: 90%;
}

/* Recent activity summary fix */
.recent-activity-summary {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.recent-activity-summary h3 {
  margin-bottom: 20px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.activity-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
}

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

.activity-summary-text {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

.activity-summary-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Fix button actions to wrap properly */
.section-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.action-btn {
  white-space: nowrap;
}

/* Responsive improvements */
@media (max-width: 1024px) {
  .main-content {
    padding: 24px 20px;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 20px 16px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 24px;
  }
  
  .stat-card h3 {
    font-size: 28px;
  }
}
