/* Helix Settings Page Styles */

:root {
  /* Warm Professional Gray Base Palette */
  --helix-color-1: #fafaf9; /* lightest */
  --helix-color-2: #f5f5f4; 
  --helix-color-3: #e7e5e4; 
  --helix-color-4: #d6d3d1; 
  --helix-color-5: #a8a29e; 
  --helix-color-6: #78716c; 
  --helix-color-7: #57534e; 
  --helix-color-8: #44403c; 
  --helix-color-9: #292524; 
  --helix-color-10: #1c1917; /* darkest */
  
  /* Accent Colors */
  --helix-success: #059669; /* darker green for warm palette */
  --helix-success-light: #d1fae5; 
  --helix-error: #dc2626; /* slightly darker red */
  --helix-error-light: #fee2e2; 
  --helix-warning: #d97706; /* warmer orange */
  --helix-warning-light: #fed7aa; 
  --helix-primary: #2563eb; /* rich blue for primary actions */
  --helix-primary-light: #dbeafe; 
}

.helix-settings-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Header */
.helix-settings-header {
  margin-bottom: 3rem;
  background: linear-gradient(135deg, var(--helix-color-8) 0%, var(--helix-color-10) 100%);
  color: white;
  padding: 3rem 2rem;
  margin: -2rem 0 3rem -2rem;
  border-radius: 0 0 24px 24px;
  position: relative;
  overflow: hidden;
}

.helix-settings-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.helix-settings-header h1 {
  font-size: 3rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.helix-settings-header p {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  position: relative;
  z-index: 1;
  font-weight: 400;
  line-height: 3;
}

/* Loading State */
.helix-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.helix-loading p {
  margin: 20px 0 0 0;
  font-size: 1.1rem;
  color: var(--helix-color-6);
}

/* Spinner */
.helix-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--helix-color-3);
  border-top: 3px solid var(--helix-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Controls */
.helix-settings-controls,
.helix-settings-footer {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  padding: 20px 0;
  border-top: 1px solid var(--helix-color-3);
}

.helix-settings-footer {
  border-bottom: 1px solid var(--helix-color-3);
  margin-top: 50px;
}

/* Save Buttons */
.helix-save-buttons {
  display: flex;
  align-items: center;
  gap: 15px;
}

.helix-btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.helix-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.helix-btn-primary {
  background: linear-gradient(135deg, var(--helix-color-8) 0%, var(--helix-color-10) 100%);
  color: white;
  border-color: var(--helix-color-8);
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.helix-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--helix-color-7) 0%, var(--helix-color-9) 100%);
  border-color: var(--helix-color-7);
  transform: translateY(-1px);
  box-shadow: 0 8px 15px -3px rgba(37, 99, 235, 0.3);
}

.helix-btn-secondary {
  background-color: white;
  color: var(--helix-color-9);
  border-color: var(--helix-color-4);
}

.helix-btn-secondary:hover:not(:disabled) {
  background-color: var(--helix-color-2);
  border-color: var(--helix-color-5);
}

.helix-save-status {
  color: var(--helix-success);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Tabs */
.helix-settings-tabs {
  margin: 30px 0;
}

.helix-tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--helix-color-3);
  overflow-x: auto;
  gap: 2px;
}

.helix-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--helix-color-6);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.helix-tab:hover {
  color: var(--helix-color-8);
  background-color: var(--helix-color-1);
}

.helix-tab.active {
  color: var(--helix-color-8);
  border-bottom-color: var(--helix-color-8);
}

.helix-tab-icon {
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.helix-tab-icon svg {
  width: 20px;
  height: 20px;
  transition: color 0.2s ease;
}

.helix-tab-indicator {
  color: #f59e0b;
  font-size: 12px;
  position: absolute;
  top: 5px;
  right: 5px;
}

/* Content */
.helix-settings-content {
  margin: 40px 0;
}

.helix-tab-panel {
  min-height: 400px;
}

/* Settings Sections */
.helix-settings-section {
  background: var(--helix-color-1);
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.5);
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.helix-settings-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.helix-settings-section-header {
  background: linear-gradient(135deg, var(--helix-color-1) 0%, var(--helix-color-2) 100%);
  padding: 24px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.helix-settings-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--helix-color-10);
  margin: 0 0 8px 0;
}

.helix-settings-section-description {
  color: var(--helix-color-6);
  margin: 0;
  font-size: 14px;
}

.helix-settings-section-content {
  padding: 24px;
}

.helix-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Ensure form fields take full width within their grid cell */
.helix-settings-grid .helix-form-field {
  width: 100%;
}

/* Handle odd number of fields - make the last field span full width if it's alone */
.helix-settings-grid .helix-form-field:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Ensure subsections don't interfere with grid layout */
.helix-settings-subsection .helix-form-field {
  margin-bottom: 16px;
}



/* Ensure consistent spacing between form fields */
.helix-settings-grid .helix-form-field + .helix-form-field {
  margin-top: 0;
}

.helix-settings-subsection {
  border-top: 1px solid var(--helix-color-3);
  padding-top: 24px;
  margin-top: 24px;
  grid-column: 1 / -1;
}

.helix-settings-subsection-header {
  grid-column: 1 / -1;
  border-top: 1px solid var(--helix-color-3);
  padding-top: 24px;
  margin-top: 24px;
}

.helix-settings-subsection h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--helix-color-9);
  margin: 0 0 20px 0;
}

/* Form Fields */
.helix-form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.helix-form-label {
  font-weight: 500;
  color: var(--helix-color-9);
  font-size: 14px;
}

.helix-required {
  color: var(--helix-error);
  margin-left: 4px;
}

.helix-form-control {
  display: flex;
  flex-direction: column;
}

.helix-form-description {
  font-size: 13px;
  color: var(--helix-color-6);
  margin: 0;
  line-height: 1.4;
}

.helix-form-error {
  font-size: 13px;
  color: var(--helix-error);
  margin: 0;
}

/* Input Elements */
.helix-text-input,
.helix-number-input,
.helix-select-input {
  padding: 10px 12px;
  border: 1px solid var(--helix-color-3);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  background: var(--helix-color-1);
}

.helix-text-input:focus,
.helix-number-input:focus,
.helix-select-input:focus {
  outline: none;
  border-color: var(--helix-color-8);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.helix-select-input {
  cursor: pointer;
}

/* Toggle Input */
.helix-toggle-field {
  margin: 16px 0;
}

.helix-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.helix-toggle-label {
  font-weight: 500;
  color: var(--helix-color-9);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.helix-toggle-label-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toggle Switch Button */
.helix-toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  flex-shrink: 0;
  outline: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.helix-toggle-switch:focus {
  box-shadow: 0 0 0 3px var(--helix-color-3);
  outline: none;
}

/* Switch States */
.helix-toggle-switch-off {
  background-color: var(--helix-color-3);
}

.helix-toggle-switch-off:hover:not(:disabled) {
  background-color: var(--helix-color-4);
}

.helix-toggle-switch-on {
  background-color: var(--helix-color-8);
}

.helix-toggle-switch-on:hover:not(:disabled) {
  background-color: var(--helix-color-9);
}

.helix-toggle-switch-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Toggle Knob */
.helix-toggle-knob {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease-in-out;
  transform: translateX(2px);
}

.helix-toggle-knob-on {
  transform: translateX(26px);
}

.helix-toggle-knob-off {
  transform: translateX(2px);
}

/* Notifications */
.helix-notification {
  background: var(--helix-color-1);
  border: 1px solid var(--helix-color-3);
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.helix-notification.visible {
  opacity: 1;
  transform: translateY(0);
}

.helix-notification-success {
  background-color: var(--helix-success-light);
}

.helix-notification-error {
  background-color: var(--helix-error-light);
}

.helix-notification-warning {
  background-color: var(--helix-warning-light);
}

.helix-notification-info {
  background-color: var(--helix-primary-light);
}

.helix-notification-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.helix-notification-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.helix-notification-message {
  flex: 1;
  font-size: 14px;
  color: var(--helix-color-9);
}

.helix-notification-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--helix-color-6);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.helix-notification-close:hover {
  color: var(--helix-color-9);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .helix-settings-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .helix-settings-subsection-header {
    margin-top: 20px;
    padding-top: 20px;
  }
}

@media (max-width: 768px) {
  .helix-settings-page {
    padding: 15px;
  }

  .helix-settings-header h1 {
    font-size: 2rem;
  }

  .helix-tabs-nav {
    flex-direction: column;
    gap: 0;
  }

  .helix-tab {
    justify-content: flex-start;
    border-bottom: 1px solid var(--helix-color-3);
    border-right: none;
  }

  .helix-tab.active {
    border-bottom-color: var(--helix-color-3);
    border-left: 3px solid var(--helix-primary);
    background-color: var(--helix-color-1);
  }

  .helix-settings-section-content,
  .helix-settings-section-header {
    padding: 20px;
  }

  .helix-settings-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .helix-settings-subsection-header {
    margin-top: 20px;
    padding-top: 20px;
  }

  .helix-save-buttons {
    flex-direction: column;
    width: 100%;
  }

  .helix-btn {
    width: 100%;
    justify-content: center;
  }
}