/* API Key Modal & Admin Dashboard Stylesheet */

.api-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 12, 20, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out forwards;
}

.api-modal-container {
  background: #141724;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(88, 101, 242, 0.15);
  display: flex;
  flex-direction: column;
  color: #f1f5f9;
  position: relative;
}

.api-modal-header {
  padding: 24px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.api-modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.api-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.api-modal-body {
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* API Key Display Box */
.api-key-box {
  background: rgba(18, 22, 36, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.api-key-input {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  width: 100%;
  outline: none;
}

.btn-icon-copy {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-icon-copy:hover {
  background: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
}

/* Quota Progress Bar */
.api-quota-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
}

.quota-title {
  color: #94a3b8;
  font-weight: 500;
}

.quota-value {
  font-weight: 700;
  color: #f1f5f9;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 6px;
  transition: width 0.4s ease;
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* Code Tabs & Documentation */
.code-doc-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.code-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.code-tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.code-tab-btn.active {
  background: rgba(88, 101, 242, 0.2);
  color: #818cf8;
}

.code-block-wrapper {
  background: #0d0f17;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #cbd5e1;
  overflow-x: auto;
  line-height: 1.5;
}

/* Admin Table Styles */
.admin-keys-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.9rem;
}

.admin-keys-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-keys-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.badge-status {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-status.revoked {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-sm-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sm-action:hover {
  background: rgba(88, 101, 242, 0.25);
  color: #fff;
}

/* User Profile Badge clickable trigger */
.user-profile-badge {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.user-profile-badge:hover {
  transform: translateY(-1px);
}

.badge-api-indicator {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0f172a;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
}

/* Admin Tabs Styling */
.admin-tabs-nav {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.admin-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.admin-tab-btn.active {
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.45);
  color: #c7d2fe;
  box-shadow: 0 0 16px rgba(129, 140, 248, 0.2);
}

.admin-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

/* Switch Toggle Styling */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  flex-shrink: 0;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 34px;
  transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.switch-toggle input:checked + .switch-slider {
  background-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(24px);
}

/* Admin Dashboard Analytics Stats Cards */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(22, 24, 29, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(99, 102, 241, 0.15);
}

.stat-card-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-card-value .stat-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* User Directory & Table Enhancements */
.admin-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.admin-search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  color: #f1f5f9;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}

.admin-search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.3);
}

.admin-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

.user-table-cell-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-table-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.user-table-names {
  display: flex;
  flex-direction: column;
}

.user-table-globalname {
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.9rem;
}

.user-table-username {
  font-size: 0.78rem;
  color: #94a3b8;
}

.ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 9px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #cbd5e1;
}

.btn-action-delete {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* Full Dashboard Sidebar Layout (Matching Mockup #3) */
.admin-dashboard-container {
  display: flex;
  width: 100%;
  max-width: 1360px;
  height: 88vh;
  max-height: 900px;
  background: #111319;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
}

.admin-sidebar {
  width: 230px;
  background: #161822;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
  user-select: none;
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 800;
  color: #f8fafc;
  padding-bottom: 20px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-nav-group-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin: 16px 0 8px 10px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin-bottom: 3px;
}

.admin-nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
}

.admin-nav-item.active {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: #475569;
}

.admin-main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111319;
}

.admin-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #161822;
  gap: 16px;
}

.admin-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-header-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-content-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px;
}

/* Dashboard Overview Widgets Grid */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 960px) {
  .dash-grid-2col {
    grid-template-columns: 1fr;
  }
}

.dash-card-widget {
  background: rgba(22, 24, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 0;
  overflow: hidden;
}

.dash-widget-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 16px;
}

.dash-top-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.dash-quick-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.dash-quick-btn.primary {
  background: #5865F2;
  color: #fff;
}

.dash-quick-btn.primary:hover {
  background: #4752c4;
  box-shadow: 0 0 16px rgba(88, 101, 242, 0.4);
}

.dash-quick-btn.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.dash-quick-btn.success:hover {
  background: rgba(16, 185, 129, 0.25);
}

.dash-quick-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.dash-quick-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.ip-badge:hover {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.ip-badge.ip-revealed {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  font-weight: 700;
}

/* Interactive Chart Dots & Tooltips */
.chart-point-node {
  cursor: pointer;
}

.chart-point-node circle {
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-point-node:hover circle {
  r: 8.5px;
  fill: #38bdf8;
  stroke: #ffffff;
  stroke-width: 3px;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.9));
}

.chart-point-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
}

.chart-point-node:hover .chart-point-tooltip {
  opacity: 1;
}

/* Mobile Responsive Overrides for Admin Modal & Dashboard */
@media (max-width: 768px) {
  .api-modal-backdrop {
    padding: 10px;
  }
  .api-modal-container {
    max-height: 95vh;
    border-radius: 14px;
  }
  .api-modal-header, .api-modal-body {
    padding: 16px;
  }

  .admin-dashboard-container {
    flex-direction: column;
    height: 94vh;
    border-radius: 14px;
  }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .admin-sidebar-header,
  .admin-nav-group-title,
  .admin-sidebar-footer {
    display: none;
  }
  .admin-nav-item {
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .admin-top-header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .admin-header-title {
    font-size: 0.95rem;
  }
  .admin-content-scrollable {
    padding: 14px;
  }

  .dash-grid-2col {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dash-card-widget {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


