/* ===== API KEY SECTION ENHANCEMENTS ===== */

/* Card Header */

.apikey-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.06), rgba(142, 9, 249, 0.02));
  border-bottom: 1px solid rgba(142, 9, 249, 0.1);
}

html[data-bs-theme="dark"] .apikey-card-header {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.14), rgba(142, 9, 249, 0.06));
  border-bottom-color: rgba(142, 9, 249, 0.22);
}

.apikey-header-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8e09f9, #6a07b8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(142, 9, 249, 0.35);
}

.apikey-header-subtitle {
  font-size: 0.78rem;
  color: #888;
}

html[data-bs-theme="dark"] .apikey-header-subtitle {
  color: #999;
}

/* Info Banner */

.apikey-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(142, 9, 249, 0.05), rgba(142, 9, 249, 0.02));
  border: 1px solid rgba(142, 9, 249, 0.12);
  margin-bottom: 24px;
}

html[data-bs-theme="dark"] .apikey-info-banner {
  background: linear-gradient(145deg, rgba(142, 9, 249, 0.1), rgba(142, 9, 249, 0.05));
  border-color: rgba(142, 9, 249, 0.22);
}

.apikey-info-icon-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.15), rgba(142, 9, 249, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e09f9;
  font-size: 16px;
}

html[data-bs-theme="dark"] .apikey-info-icon-wrap {
  background: linear-gradient(135deg, rgba(179, 102, 255, 0.22), rgba(179, 102, 255, 0.1));
  color: #b366ff;
}

.apikey-code-tag {
  background: rgba(142, 9, 249, 0.1);
  color: #6a07b8;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

html[data-bs-theme="dark"] .apikey-code-tag {
  background: rgba(179, 102, 255, 0.15);
  color: #c89bff;
}

/* ===== API Key Field Wrapper ===== */

.apikey-field-wrapper {
  background: linear-gradient(145deg, rgba(142, 9, 249, 0.03), transparent);
  border: 1px solid rgba(142, 9, 249, 0.1) !important;
  border-radius: 16px !important;
  padding: 20px !important;
  margin-bottom: 24px;
  display: flex !important;
  flex-wrap: wrap !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

html[data-bs-theme="dark"] .apikey-field-wrapper {
  background: linear-gradient(145deg, rgba(142, 9, 249, 0.07), rgba(142, 9, 249, 0.03));
  border-color: rgba(142, 9, 249, 0.2) !important;
}

/* Reset all input-group-text children inside the wrapper */

.apikey-field-wrapper > .input-group-text {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  width: 100% !important;
  border-radius: 0 !important;
  flex: unset !important;
}

/* Label */

.apikey-field-label {
  display: flex !important;
  align-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 10px;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  flex: unset !important;
}

.apikey-field-label i {
  color: #8e09f9;
}

html[data-bs-theme="dark"] .apikey-field-label {
  color: #bbb;
}

/* ===== Input + Buttons on same row ===== */

.apikey-input-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(142, 9, 249, 0.18) !important;
  border-radius: 14px !important;
  padding: 4px !important;
  transition: all 0.25s ease;
  width: 100% !important;
  flex-wrap: nowrap !important;
}

html[data-bs-theme="dark"] .apikey-input-group {
  background: rgba(30, 33, 39, 0.8) !important;
  border-color: rgba(179, 102, 255, 0.25) !important;
}

.apikey-input-group:focus-within {
  border-color: #8e09f9 !important;
  box-shadow: 0 0 0 3px rgba(142, 9, 249, 0.12), 0 4px 16px rgba(142, 9, 249, 0.08);
}

/* Password input fills remaining space */

.apikey-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  padding: 10px 14px !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: auto !important;
  border-radius: 10px !important;
}

.apikey-input:focus {
  box-shadow: none !important;
  border: none !important;
}

/* Action buttons stay at the end */

.apikey-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.apikey-action-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  transition: all 0.25s ease;
  font-size: 15px;
  border: none;
}

.apikey-toggle-btn {
  background: rgba(142, 9, 249, 0.08);
  color: #8e09f9;
}

.apikey-toggle-btn:hover {
  background: rgba(142, 9, 249, 0.16);
  color: #6a07b8;
  transform: scale(1.05);
}

html[data-bs-theme="dark"] .apikey-toggle-btn {
  background: rgba(179, 102, 255, 0.12);
  color: #b366ff;
}

html[data-bs-theme="dark"] .apikey-toggle-btn:hover {
  background: rgba(179, 102, 255, 0.22);
  color: #c89bff;
}

.apikey-copy-btn {
  background: linear-gradient(135deg, #8e09f9, #6a07b8);
  color: white;
  box-shadow: 0 3px 10px rgba(142, 9, 249, 0.3);
}

.apikey-copy-btn:hover {
  background: linear-gradient(135deg, #7a07d9, #5a069c);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 5px 16px rgba(142, 9, 249, 0.4);
}

/* ===== Regenerate Button ===== */

.apikey-field-wrapper > .d-flex.input-group-text {
  margin-top: 14px;
  display: flex !important;
}

.apikey-regenerate-btn {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.05));
  color: #e65100;
  border: 1px solid rgba(255, 152, 0, 0.25) !important;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 18px !important;
  border-radius: 12px !important;
  transition: all 0.25s ease;
}

.apikey-regenerate-btn:hover {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.18), rgba(255, 152, 0, 0.1));
  color: #bf360c;
  border-color: rgba(255, 152, 0, 0.4) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 152, 0, 0.18);
}

html[data-bs-theme="dark"] .apikey-regenerate-btn {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.08));
  color: #ffb74d;
  border-color: rgba(255, 152, 0, 0.3) !important;
}

html[data-bs-theme="dark"] .apikey-regenerate-btn:hover {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.25), rgba(255, 152, 0, 0.15));
  color: #ffc107;
  border-color: rgba(255, 152, 0, 0.5) !important;
}

/* ===== Usage Section ===== */

.apikey-usage-section {
  border-top: none;
  padding-top: 0;
}

.apikey-usage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(142, 9, 249, 0.1);
}

.apikey-usage-icon-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.12), rgba(142, 9, 249, 0.06));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e09f9;
  font-size: 15px;
}

html[data-bs-theme="dark"] .apikey-usage-icon-wrap {
  background: linear-gradient(135deg, rgba(179, 102, 255, 0.2), rgba(179, 102, 255, 0.1));
  color: #b366ff;
}

/* ===== Table ===== */

.apikey-table-wrapper {
  border: 1px solid rgba(142, 9, 249, 0.12);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(142, 9, 249, 0.02);
}

html[data-bs-theme="dark"] .apikey-table-wrapper {
  background: rgba(142, 9, 249, 0.05);
  border-color: rgba(142, 9, 249, 0.22);
}

.apikey-table thead th {
  background: rgba(142, 9, 249, 0.06);
  color: #6a07b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 1px solid rgba(142, 9, 249, 0.12) !important;
  padding: 12px 14px;
  white-space: nowrap;
}

html[data-bs-theme="dark"] .apikey-table thead th {
  background: rgba(142, 9, 249, 0.12);
  color: #c89bff;
  border-bottom-color: rgba(142, 9, 249, 0.25) !important;
}

.apikey-table tbody td {
  vertical-align: middle;
  border-color: rgba(142, 9, 249, 0.06);
  padding: 10px 14px;
  font-size: 0.85rem;
}

.apikey-table tbody tr {
  transition: background 0.2s ease;
}

.apikey-table tbody tr:hover {
  background: rgba(142, 9, 249, 0.04);
}

html[data-bs-theme="dark"] .apikey-table tbody td {
  border-color: rgba(142, 9, 249, 0.12);
}

html[data-bs-theme="dark"] .apikey-table tbody tr:hover {
  background: rgba(142, 9, 249, 0.08);
}

/* ===== Responsive ===== */

@media (max-width: 576px) {
  .apikey-input-group {
    flex-wrap: wrap !important;
    gap: 6px;
    padding: 8px !important;
  }
}

@media (max-width: 576px) {
  .apikey-input {
    flex: 1 1 100% !important;
  }
}

@media (max-width: 576px) {
  .apikey-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

