/* ═══════════════════════════════════════════════════════════
   admin.css — Redesigned Premium Admin Panel Styles
   ═══════════════════════════════════════════════════════════ */

.admin-page {
  height: 100vh;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px max(32px, 8vw) 80px max(32px, 8vw);
  background: 
    radial-gradient(circle at 10% 10%, rgba(220, 38, 38, 0.12), transparent 45%),
    radial-gradient(circle at 90% 90%, rgba(185, 28, 28, 0.08), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.95), #09090b);
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 38, 38, 0.4) rgba(15, 15, 18, 0.8);
}

/* Custom Scrollbar for Admin Page */
.admin-page::-webkit-scrollbar {
  width: 8px;
}

.admin-page::-webkit-scrollbar-track {
  background: rgba(10, 10, 14, 0.6);
  border-radius: 4px;
}

.admin-page::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.6) 0%, rgba(153, 27, 27, 0.6) 100%);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.2);
}

.admin-page::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.8) 0%, rgba(185, 28, 28, 0.8) 100%);
  box-shadow: 0 0 14px rgba(220, 38, 38, 0.4);
}

.admin-container {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 36px; /* Generous vertical gap between section cards */
  width: 100%;
}

/* Header styling */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px;
  background: rgba(18, 18, 22, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.admin-header-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(153, 27, 27, 0.08) 100%);
  border: 1px solid rgba(220, 38, 38, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
  font-size: var(--text-xl);
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.2);
}

.admin-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Thmanyah Sans', sans-serif;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.admin-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

.btn-back {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--color-text-secondary) !important;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 18px !important;
  border-radius: var(--radius-lg) !important;
  font-size: var(--text-sm) !important;
  font-weight: 500 !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  font-family: 'Thmanyah Sans', sans-serif;
  cursor: pointer;
}

.btn-back:hover {
  background: rgba(220, 38, 38, 0.15) !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
  color: #ffffff !important;
  transform: translateX(-3px);
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.15);
}

/* Glassmorphism Section styling */
.admin-section {
  background: rgba(18, 18, 22, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.admin-section:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5), 0 0 20px rgba(220, 38, 38, 0.04);
}

.admin-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
  font-size: var(--text-md);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.1);
}

.admin-section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #ffffff;
  font-family: 'Thmanyah Sans', sans-serif;
  margin: 0 0 4px 0;
}

.admin-section-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

/* Forms styling */
.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
}

.admin-form .full-width {
  grid-column: 1 / -1;
}

.admin-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-form .form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.admin-form .form-label i {
  color: var(--color-primary-light);
  font-size: 11px;
}

.admin-form .form-input {
  background: rgba(10, 10, 14, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
  border-radius: var(--radius-lg) !important;
  padding: 14px 18px !important;
  font-size: var(--text-sm) !important;
  transition: all 0.25s ease !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.admin-form .form-input:hover {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.admin-form .form-input:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), 0 0 16px rgba(220, 38, 38, 0.2) !important;
  background: rgba(15, 15, 20, 0.8) !important;
  outline: none !important;
}

/* Password Toggle Wrapper */
.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-password-wrapper .form-input {
  width: 100%;
  padding-left: 44px !important;
}

.btn-toggle-password {
  position: absolute;
  left: 14px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.btn-toggle-password:hover {
  color: #ffffff;
  transform: scale(1.1);
}

/* Actions & Buttons styling */
.connection-action-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-test-conn {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 24px !important;
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
  border-radius: var(--radius-lg) !important;
  transition: all 0.3s ease !important;
  cursor: pointer;
}

.btn-test-conn:hover {
  background: rgba(220, 38, 38, 0.15) !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.15);
}

.admin-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0; /* Clear spacing above and below save button bar */
}

.btn-save {
  background: linear-gradient(135deg, var(--color-primary) 0%, #b91c1c 100%) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35) !important;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 36px !important;
  font-size: var(--text-md) !important;
  font-weight: 700 !important;
  border-radius: var(--radius-xl) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(220, 38, 38, 0.5) !important;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* Cloud switch toggle row */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-name {
  font-weight: 600;
  color: #ffffff;
  font-size: var(--text-sm);
}

.setting-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Custom switch slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #d4d4d8;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input:checked + .toggle-slider {
  background-color: var(--color-primary);
  border-color: var(--color-primary-light);
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background-color: #ffffff;
}

/* Users table styling */
.users-table-wrapper {
  background: rgba(10, 10, 14, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 38, 38, 0.4) rgba(15, 15, 18, 0.6);
}

.users-table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.users-table-wrapper::-webkit-scrollbar-track {
  background: rgba(10, 10, 14, 0.5);
}

.users-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(220, 38, 38, 0.4);
  border-radius: 3px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.users-table th {
  padding: 16px 20px;
  text-align: right;
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 2;
}

.users-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary);
}

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

.users-table tr:hover td {
  background: rgba(220, 38, 38, 0.04);
  color: #ffffff;
}

.user-cell-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: #ffffff;
}

.user-cell-name i {
  color: var(--color-primary-light);
}

.badge-admin {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.15);
}

.badge-user {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: var(--text-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete-user {
  background: rgba(239, 68, 68, 0.08) !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  color: var(--color-error) !important;
  padding: 6px 14px !important;
  border-radius: var(--radius-md) !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.btn-delete-user:hover {
  background: var(--color-error) !important;
  color: #ffffff !important;
  border-color: var(--color-error) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

/* Connection status box */
.connection-status {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.connection-status.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

.connection-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

@media (max-width: 640px) {
  .admin-form {
    grid-template-columns: 1fr;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
}