/* API Settings Page Styles */

.api-settings-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.settings-section {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.section-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

/* API Keys List */
.api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-key-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.api-key-item:hover {
  border-color: hsl(var(--foreground) / 0.2);
  transform: translateX(2px);
}

.key-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--card));
  border-radius: 0.5rem;
  color: hsl(var(--foreground));
  font-size: 1.5rem;
}

.key-details {
  flex: 1;
  min-width: 0;
}

.key-label {
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.key-masked {
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
}

.key-meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.key-separator {
  opacity: 0.5;
}

.key-actions {
  display: flex;
  gap: 0.5rem;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid hsl(var(--border));
  border-top-color: hsl(var(--foreground));
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

@keyframes btn-spin {
  to { 
    transform: rotate(360deg); 
  }
}

.btn-spinner {
  animation: btn-spin 1s linear infinite;
  display: inline-block;
}

.btn-spinner circle {
  opacity: 0.25;
  stroke: currentColor;
}

.btn-spinner circle:first-child {
  stroke-dasharray: 80;
  stroke-dashoffset: 60;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

.empty-state svg {
  color: hsl(var(--foreground));
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* Documentation Card */
.documentation-card {
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  padding: 1rem;
}

.doc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.doc-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  color: hsl(var(--foreground));
}

.doc-link:hover {
  border-color: hsl(var(--foreground) / 0.2);
  transform: translateY(-2px);
}

.doc-link svg {
  color: hsl(var(--foreground));
}

.doc-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--secondary));
  border-radius: 0.375rem;
  color: hsl(var(--foreground));
  font-size: 1.25rem;
}

.doc-content {
  flex: 1;
}

.doc-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.125rem;
}

.doc-description {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px hsl(var(--foreground) / 0.2);
}

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

.btn-secondary:hover {
  background: hsl(var(--foreground) / 0.05);
}

.btn-danger {
  background: hsl(0 70% 50%);
  color: white;
}

.btn-danger:hover {
  background: hsl(0 70% 45%);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.125rem;
}

.btn-icon:hover {
  background: hsl(var(--foreground) / 0.1);
}

.btn-delete {
  color: hsl(0 70% 50%);
  border-color: hsl(0 70% 50% / 0.2);
}

.btn-delete:hover {
  background: hsl(0 70% 50% / 0.1);
  border-color: hsl(0 70% 50% / 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.4);
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: hsl(var(--secondary));
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: hsl(var(--foreground));
}

.btn-copy{
  color: hsl(var(--foreground));
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: hsl(var(--foreground) / 0.1);
}

.modal-content {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  flex: 1;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.3);
}

/* Warning Message */
.warning-message {
  padding: 1rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.warning-message h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.warning-message p {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

/* New Key Display */
.new-key-display {
  margin-bottom: 1rem;
}

.new-key-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.new-key-value-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.new-key-value {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  word-break: break-all;
  user-select: all;
}

.btn-copy {
  flex-shrink: 0;
}

.delete-key-label {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.delete-key-label strong {
  color: hsl(var(--foreground));
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .api-settings-content {
    padding: 1rem 0.5rem;
  }

  .settings-section {
    padding: 1rem;
  }

  .section-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .doc-links {
    grid-template-columns: 1fr;
  }

  .api-key-item {
    flex-wrap: wrap;
  }

  .key-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
