.settings-page {
  .loading-state,
  .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    gap: 0.75rem;
    background: var(--color-surface);
    border-radius: 10px;

    i { font-size: 2rem; color: var(--color-danger); }
    p { color: var(--color-text-secondary); }
  }

  :host ::ng-deep {
    .p-tabs {
      .p-tablist {
        background: var(--color-surface);
        border-radius: 10px 10px 0 0;
        border-bottom: 1px solid var(--color-surface-border);
      }
      .p-tab {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        font-weight: 500;
        color: var(--color-text-secondary);

        &.p-tab-active {
          color: var(--color-accent);
          font-weight: 600;
        }

        .tab-icon { margin-inline-end: 0.3rem; }
      }
      .p-tabpanels {
        background: transparent;
        padding: 0;
      }
      .p-tabpanel { padding: 0; }
    }
  }
}

// ── Unified grouped-row design for all tabs ──

.mod-save-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
}

.mod-group {
  background: var(--color-surface);
  border-radius: 10px;
  border: 1px solid var(--color-surface-border);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.mod-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--color-surface-ground, #f8fafc);
  border-bottom: 1px solid var(--color-surface-border);

  i {
    font-size: 1rem;
    color: var(--color-brand, #1a237e);
  }

  h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
  }
}

.mod-group-body {
  padding: 0.25rem 0;
}

.mod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid var(--color-surface-border, rgba(0, 0, 0, 0.03));

  &:last-child {
    border-bottom: none;
  }

  &:hover {
    background: var(--color-surface-ground, rgba(0, 0, 0, 0.015));
  }
}

.mod-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;

  .mod-row-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
  }

  .mod-row-desc {
    font-size: 0.7rem;
    color: var(--color-text-muted);
  }
}

.mod-row-control {
  flex-shrink: 0;
  min-width: 200px;

  :host ::ng-deep {
    .p-inputtext {
      padding: 0.375rem 0.5rem;
      font-size: 0.8125rem;
    }
    .p-inputnumber-input {
      padding: 0.375rem 0.5rem;
      font-size: 0.8125rem;
    }
    .p-select {
      font-size: 0.8125rem;
    }
    .p-select .p-select-label {
      padding: 0.375rem 0.5rem;
    }
    .p-toggleswitch {
      transform: scale(0.85);
    }
  }
}

// Inline edit mode for backend-defined settings
.mod-row-edit {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
}

// Display mode (clickable to edit)
.mod-row-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s;

  &:hover {
    background: var(--color-surface-hover, rgba(0, 0, 0, 0.04));

    .edit-icon { opacity: 1; }
  }

  span {
    font-size: 0.8125rem;
    color: var(--color-text-primary);
  }

  .edit-icon {
    font-size: 0.7rem;
    color: var(--color-info);
    opacity: 0;
    transition: opacity 0.15s;
  }
}

.empty-tab {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  .color-input {
    width: 36px;
    height: 36px;
    border: 2px solid var(--color-surface-border);
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: transparent;

    &::-webkit-color-swatch-wrapper { padding: 0; }
    &::-webkit-color-swatch { border: none; border-radius: 5px; }
    &::-moz-color-swatch { border: none; border-radius: 5px; }
  }

  .color-hex {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
  }
}
