// Isolate theme popup from header colors while respecting light/dark mode
.overlay,
.overlay * {
  color: var(--text-primary) !important;

  mat-icon {
    color: var(--text-primary) !important;
  }
}

// Specific element overrides for theme popup
.overlay {
  .popup-content {
    color: var(--text-primary) !important;
  }

  h2 {
    color: var(--text-primary) !important;
  }

  .section-title {
    color: var(--text-primary) !important;
  }

  .theme-name {
    color: var(--text-primary) !important;
  }

  .mode-switch span {
    color: var(--text-primary) !important;
  }

  .apply-btn mat-icon,
  .save-btn mat-icon,
  .close-icon mat-icon {
    color: var(--text-primary) !important;
  }

  // Exception for save button icon (should stay white)
  .save-btn mat-icon {
    color: #FFFFFF !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  overflow: hidden;
  animation: fadeIn 0.3s ease-in-out;
}

.popup-content {
  background-color: var(--text-onPrimary, #ffffff);
  color: var(--text-primary, #111111);
  border-radius: 8px;
  padding: 20px 24px;
  width: 768px;
  height: 480px;
  max-width: 95%;
  max-height: 95%;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  animation: scaleIn 0.3s ease-in-out;
  z-index: 3001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h2 {
  font-size: 18px;
  font-weight: bold;
  color: var(--button-primary-bg-disabled);
  margin: 0;
}

.action-buttons {
  display: flex;
  gap: 16px;
}

// .action-buttons,
// .action-buttons {
//   display: flex;
//   justify-content: center;
//   align-items: center;
//   padding: 6px 14px;
//   width: 120px;
//   height: 28px;
//   border-radius: 6px;
//   font-size: 12px;
//   cursor: pointer;
//   transition: 0.3s;
// }

.apply-btn,
.save-btn {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  justify-content: center;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.close-icon {
  display: flex;
  align-items: center;
  color: #818181;
  cursor: pointer;
}

.sa {
  padding-right: 20px;
}

.action-button {
  border: 1px solid var(--action-primary-default);
  color: var(--text-primary);
  background-color: var(--text-onPrimary, #ffffff);
}

// .action-buttons {
//   background: var(--action-primary-default);
//   color: #fff;
// }

// .action-buttons {
//   background: var(--action-primary-default);
//   border: 1px solid var(--action-primary-default);
//   color: #fff;
// }

// .action-buttons button {
//   display: flex;
//   align-items: center;
//   gap: 4px;
//   font-size: 13px;
//   border-radius: 6px;
//   padding: 6px 14px;
//   cursor: pointer;
//   background: transparent;
//   border: none;
//   transition: 0.3s;
// }

// .action-buttons button mat-icon {
//   padding-left: 10px;
//   padding-top: 4.1px;
//   font-size: 16px;
// }

// .action-buttons.close {
//   background: none;
//   border: none;
//   padding: 0;
//   margin: 0;
//   cursor: pointer;
//   display: inline-flex;
//   align-items: center;
//   justify-content: center;
//   color: rgb(46, 44, 44);
//   font-size: 20px;
// }

// body.dark-mode .action-buttons .close-btn {
//   background-color: #fff;
//   color: #000;
// }

// .action-buttons .close-btn:hover {
//   opacity: 0.85;
// }

.theme-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
  // overflow-y: auto;
  padding-right: 8px;
}

.themes-section {
  flex: 1;
  min-width: 200px;
}

.themes-section .section-title {
  font-weight: bold;
  font-size: 12px;
  color: var(--action-primary-default);
  margin-bottom: 12px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 6px;
  opacity: 1;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.theme-option:hover {
  background-color: var(--text-onPrimary);
}

.theme-option.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.theme-option.disabled:hover {
  background-color: transparent;
}

.theme-option .swatch {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: currentColor;
  border: 1px solid var(--text-disabled);
  transition: border-color 0.2s ease;
}

.theme-option .swatch::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, transparent 50%, var(--mode-color, #ffffff) 50%);
  z-index: 1;
  pointer-events: none;
}

.theme-option.selected .swatch {
  border-color: var(--action-primary-default);
}

.theme-option .theme-name {
  font-size: 12px;
  color: var(--text-primary, #111111);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.mdc-switch__shadow {
  background-color: var(--text-secondary) !important;
  /* or any color */
}

.mode-section {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.mode-section .section-title {
  font-weight: bold;
  font-size: 12px;
  color: var(--action-primary-default);
  margin-bottom: 12px;
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  white-space: nowrap;
}

.mode-switch span {
  font-size: 13px;
  color: var(--text-primary, #444444);
}

mat-checkbox {
  font-size: 12px;
  color: var(--text-primary, #111111) !important;
  margin-left: -8px;
  margin-top: 2px;
}

::ng-deep .mdc-form-field>label {
  font-size: 12px;
  color: var(--text-primary, #111111) !important;
  margin-left: -6px;
  margin-top: 2px;
}

::ng-deep .mat-mdc-select-value-text {
  color: var(--action-primary-default) !important;
}

::ng-deep .mat-mdc-tab-group,
::ng-deep .mat-mdc-tab-body-wrapper {
  height: 100%;
}

::ng-deep .mat-mdc-tab {
  color: var(--action-primary-default);
}

::ng-deep .mat-mdc-tab-header {
  border-bottom: 1px solid var(--border-color);
}

::ng-deep .mat-mdc-slide-toggle .mdc-switch__track {
  width: 40px !important;
  height: 24px !important;
  border-radius: 30px !important;
}

::ng-deep .mat-mdc-slide-toggle .mdc-switch__handle-track {
  height: 24px !important;
}

::ng-deep .mat-mdc-slide-toggle .mdc-switch__handle {
  width: 20px !important;
  height: 20px !important;
}

::ng-deep .mat-mdc-slide-toggle .mdc-switch__track::before {
  background-color: #ECE4F8 !important;
}

::ng-deep .mat-mdc-slide-toggle .mdc-switch__track::after {
  background-color: var(--action-primary-default) !important;
}


::ng-deep .mdc-switch__track {
  width: 40px !important;
}

::ng-deep .mdc-checkbox__native-control:enabled:checked~.mdc-checkbox__background,
::ng-deep .mdc-checkbox__native-control:enabled:indeterminate~.mdc-checkbox__background {
  border-color: var(--action-primary-default) !important;
  background-color: var(--action-primary-default) !important;
}


::ng-deep .mdc-checkbox__checkmark {
  color: white !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

:host ::ng-deep .mdc-switch:not(.mdc-switch--disabled) .mdc-switch__shadow {
  background-color: var(--text-secondary) !important;
}


/* inside component.scss */
:host ::ng-deep .mdc-switch__ripple,
:host ::ng-deep .mdc-switch__shadow,
:host ::ng-deep .mat-mdc-slide-toggle .mat-ripple,
:host ::ng-deep .mat-mdc-slide-toggle .mat-mdc-focus-indicator {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  box-shadow: none !important;
  background: none !important;
}


::ng-deep .mdc-switch__icon.mdc-switch__icon--off {
  display: none !important;
}

::ng-deep .mdc-switch__icon.mdc-switch__icon--on {
  background-color: #FFFFFF !important;
  border-radius: 50% !important;
}

::ng-deep .mat-mdc-checkbox .mat-ripple-element {
  display: none !important;
}

/* Optional: Also remove ripple container if needed */
::ng-deep .mat-mdc-checkbox .mdc-checkbox__ripple {
  display: none !important;
}