/* Settings Widget Styles */

/* Main settings widget container */
.sage-ai-settings {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sage-ai-settings-container {
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0 !important;
}

/* Ensure codebase manager doesn't break the layout */
.sage-ai-settings-container > div {
  flex-shrink: 0;
}

.sage-ai-settings-title {
  margin: 0 0 20px 0;
  color: var(--jp-ui-font-color0);
  flex-shrink: 0; /* Prevent shrinking */
  padding-left: 16px;
  padding-top: 40px;
}

/* Configuration sections */
.sage-ai-config-section {
  margin-bottom: 20px;
  padding-left: 20px;
  flex-shrink: 0; /* Prevent shrinking */
}

.sage-ai-config-title {
  margin-bottom: 15px;
  color: var(--jp-ui-font-color0);
  flex-shrink: 0; /* Prevent shrinking */
}

/* Form fields */
.sage-ai-field-container {
  margin-bottom: 15px;
  flex-shrink: 0; /* Prevent shrinking */
}

.sage-ai-field-label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.sage-ai-field-input {
  width: 100%;
  max-width: 400px;
  padding: 8px;
  border: 1px solid var(--jp-border-color1);
  border-radius: 4px;
  font-size: 14px;
  background-color: var(--jp-layout-color0);
  color: var(--jp-ui-font-color0);
  box-sizing: border-box;
}

/* Database input with refresh button */
.sage-ai-database-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sage-ai-database-input {
  flex: 1;
}

.sage-ai-refresh-button {
  padding: 8px 12px;
  border: 1px solid var(--jp-border-color1);
  border-radius: 4px;
  background-color: var(--jp-layout-color1);
  color: var(--jp-ui-font-color0);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sage-ai-refresh-button:hover:not(:disabled) {
  background-color: var(--jp-layout-color2);
  border-color: var(--jp-brand-color1);
}

.sage-ai-refresh-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sage-ai-refresh-button:active:not(:disabled) {
  transform: rotate(180deg);
}

/* Cache status */
.sage-ai-cache-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--jp-ui-font-color2);
}

.sage-ai-cache-indicator {
  font-size: 14px;
}

.sage-ai-cache-indicator.cached {
  color: var(--jp-success-color1);
}

.sage-ai-cache-indicator.expired {
  color: var(--jp-warn-color1);
}

.sage-ai-cache-indicator.not-cached {
  color: var(--jp-ui-font-color3);
}

.sage-ai-cache-text {
  font-family: var(--jp-ui-font-family);
}

/* Token mode container */
.sage-token-mode-container {
  margin-bottom: 20px;
  padding-left: 20px;
  flex-shrink: 0; /* Prevent shrinking */
}

.sage-token-mode-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.sage-token-mode-checkbox {
  margin-right: 8px;
}

/* Enhanced Database Metadata Spinner */
.sage-ai-db-metadata-spinner {
  position: relative;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sage-ai-db-spinner-ring {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top: 2px solid var(--jp-brand-color1);
  border-right: 2px solid var(--jp-brand-color1);
  border-radius: 50%;
  animation: sage-ai-db-spinner-rotate 1.2s linear infinite;
}

.sage-ai-db-spinner-pulse {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--jp-brand-color1);
  border-radius: 50%;
  animation: sage-ai-db-spinner-pulse 1.5s ease-in-out infinite;
}

@keyframes sage-ai-db-spinner-rotate {
  0% {
    transform: rotate(0deg);
    border-top-color: var(--jp-brand-color1);
    border-right-color: transparent;
  }
  25% {
    border-top-color: var(--jp-brand-color1);
    border-right-color: var(--jp-brand-color1);
  }
  50% {
    transform: rotate(180deg);
    border-top-color: transparent;
    border-right-color: var(--jp-brand-color1);
  }
  75% {
    border-top-color: var(--jp-brand-color1);
    border-right-color: var(--jp-brand-color1);
  }
  100% {
    transform: rotate(360deg);
    border-top-color: var(--jp-brand-color1);
    border-right-color: transparent;
  }
}

@keyframes sage-ai-db-spinner-pulse {
  0%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}
