/* Settings Page Layout - CoPlanner Integration */
.settings-layout {
  display: flex;
  gap: 2rem;
  min-height: calc(100vh - 200px);
}

.settings-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bs-card-bg, #fff);
  border-radius: var(--bs-border-radius, 0.5rem);
  padding: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.settings-content {
  flex: 1;
  min-width: 0;
}

/* Settings Navigation */
.settings-nav-category {
  margin-bottom: 2rem;
}

.settings-nav-category:last-child {
  margin-bottom: 0;
}

.settings-nav-category-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary, #6c757d);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.settings-nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.75rem;
  color: var(--bs-body-color, #212529);
  text-decoration: none;
  border-radius: var(--bs-border-radius-sm, 0.25rem);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.settings-nav-link:hover {
  background-color: var(--bs-light, #f8f9fa);
  color: var(--bs-primary, #0d6efd);
}

.settings-nav-link.active {
  background-color: var(--bs-primary, #0d6efd);
  color: #fff;
  font-weight: 500;
}

.settings-nav-link i {
  margin-right: 0.75rem;
  font-size: 1.125rem;
  width: 1.25rem;
  text-align: center;
}

/* Settings Cards */
.settings-card {
  background: var(--bs-card-bg, #fff);
  border-radius: var(--bs-border-radius, 0.5rem);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.settings-card:last-child {
  margin-bottom: 0;
}

.settings-section-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.settings-section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--bs-heading-color, #212529);
}

.settings-section-header p {
  margin: 0;
  color: var(--bs-secondary, #6c757d);
  font-size: 0.9375rem;
}

/* Form Styling */
.settings-card .form-group {
  margin-bottom: 1.5rem;
}

.settings-card .form-group:last-child {
  margin-bottom: 0;
}

.settings-card label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

.settings-card .help-text {
  font-size: 0.875rem;
  color: var(--bs-secondary, #6c757d);
  margin-top: 0.25rem;
  display: block;
}

/* Action Buttons */
.settings-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.settings-actions .btn {
  min-width: 120px;
}

/* Responsive Design */
@media (max-width: 992px) {
  .settings-layout {
    flex-direction: column;
  }
  
  .settings-sidebar {
    width: 100%;
    position: static;
    margin-bottom: 2rem;
  }
}

/* Background Job Progress */
.progress-container {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bs-light, #f8f9fa);
  border-radius: var(--bs-border-radius, 0.5rem);
}

.progress {
  height: 1.5rem;
  margin-bottom: 0.5rem;
}

.progress-message {
  font-size: 0.875rem;
  color: var(--bs-secondary, #6c757d);
  text-align: center;
}

/* Dark theme overrides for settings sidebar and layout */
body.dark-theme .settings-sidebar {
  background: #1f2225 !important;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .settings-sidebar .nav-link {
  color: #e0e0e0 !important;
}

body.dark-theme .settings-sidebar .nav-link:hover {
  background-color: #343a40 !important;
  color: #fff !important;
}

body.dark-theme .settings-sidebar .nav-link.active {
  background-color: #4a90e2 !important;
  color: #fff !important;
}

body.dark-theme .progress-container {
  background: #2d3436 !important;
}

/* CRM Framework Toggles (SPIN / MEDDIC settings pages) ----------------------
 * Dedicated, larger, green-when-active enable switches for "Enable SPIN
 * Selling framework" / "Enable MEDDIC qualification framework". Scoped to
 * .cp-framework-toggle only, so no other .form-switch in the app is
 * affected by the sizing or color override.
 */
.cp-framework-toggle {
  transform: scale(1.6);
  transform-origin: center;
  margin: 0.5rem 0.6rem;
  cursor: pointer;
}

.cp-framework-toggle:checked {
  background-color: #198754; /* Bootstrap "success" green = framework active */
  border-color: #198754;
}

/* Explicit grey for the OFF state, so "enabled = green" / "disabled = grey"
 * reads clearly at a glance (module toggles on the Organization page, and
 * any other .cp-framework-toggle switch that isn't checked). */
.cp-framework-toggle:not(:checked) {
  background-color: #adb5bd;
  border-color: #adb5bd;
}

.cp-framework-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Greyed-out state for the tabbed question editor (SPIN) / stage-gate
 * threshold editor (MEDDIC) while their framework toggle is OFF.
 *
 * Deliberately uses ONLY opacity — never `pointer-events: none` — because
 * the admin must still be able to add/edit/remove questions or change
 * thresholds while the framework itself is disabled. The grey-out is a
 * purely visual "currently inactive" status signal, not a field lock.
 */
.cp-framework-disabled {
  opacity: 0.45;
  transition: opacity 0.2s ease-in-out;
}
